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
Thanks
1 Like
arivu96
(Arivazhagan A)
February 22, 2023, 5:48am
2
Hi @404_Error ,
please follow below steps
use for each row to loop the datatable
Inside use for each activity to loop columns dt.Columns
inside check if condition row(Item).ToString()="true"
if yes increase count to intCount=intCount+1
outside of for each row(“Day”)=intCount.ToString()
Regards,
Arivu
1 Like
Anil_G
(Anil Gorthi)
February 22, 2023, 5:48am
3
@404_Error
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
Cheers
4 Likes
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
Regards
Sudharsan
1 Like
This solution worked for me, thanks
2 Likes
system
(system)
Closed
February 25, 2023, 6:04am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.