Count with specific value in row

Hi all, I would like to count the number of a certain value in a table column and have not found anything suitable in the forum, how can I count a value?

1 Like

@NHoe

It’s better if you can share some sample input and output files ?

Thanks

Hi @Srini84
I have a read range activity where I want to know for each row entry how many times it occurs in the total column.

unfortunately, we cannot see al details.
However it seems that something is aimed, but can be handled different

Could it be the case that you will have different Artikennummern in the dt like

#12
#13
#12
#24

And you would like to know the different counts like:
#12|2
#13|1
#24|1

or you want to know often #12 is in the dt (a so called filter case and filter result count case)

I would like to achieve exactly that

Could it be the case that you will have different item numbers in the dt like

#12
#13
#12
#24

And you would like to know the different counts like:
#12|2
#13|1
#24|1

Use Build datatable Activity - output: dtReport

  • Configure 2 Columns - ArtNr, Count, no datarow

Assign Activity:
LHS: dtReport (linkes feld von der Aktivität)
RHS:

(From d in inputDT.AsEnumerable
Group d by k=d(ColNameOrIndex).toString.Trim into grp=Group
Let ra = new Object(){k, grp.Count}
Select r = dtReport.Rows.Add(ra)).CopyToDatTable

ColNameOrIndex: adopt it to your specific case, surround ColumnName with "

Also have a look here:

Hello, I found the following in the forum and it works as desired.

dt.AsEnumerable.Count(Function(r) r(“Artikelnummer”).ToString=“Test”)

Mark it as a solution for future people having the same issue to find it easy.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.