How to get the value count in particular Row

Hi guys,

I am looping through the each row. I have 7-8 columns.

So, I am trying to get the “True” Value count from each row.

For example:

M A E N Dos Day
True True False True 1
False False True False 5
True True True False 8

in the Above table for the first iteration i need a count as 3 because we have only 3 True values
in the second iteration i need a count as 1
in the third iteration i need a count as 3


1 Like

Hi @404_Error ,
please follow below steps

  1. use for each row to loop the datatable
  2. Inside use for each activity to loop columns dt.Columns
  3. inside check if condition row(Item).ToString()="true"
  4. if yes increase count to intCount=intCount+1
  5. outside of for each row(“Day”)=intCount.ToString()


1 Like


Use for loop on the datatable and then use this inside to get the count

Total = currentrow.Itemarray.Count(function(x) x.ToString.Equals("True"))

Atlernately on excel you can use countif formula and use autofill range activity



Thank you,

i was trying the same but in different way.

currentrow.Itemarray.GroupBy(function(x) x.ToString.Equals("True")).Count

now i resolved it.

Thank you once again

1 Like

HI @404_Error

Checkout this expression

CurrentRow.ItemArray.AsEnumerable().Where(Function(a) a.ToString.ToUpper.Contains("TRUE")).ToList.Count

Use this inside the For each


1 Like

This solution worked for me, thanks


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