hsendel
November 21, 2021, 2:19pm
1
Dears,
How to Count Number of Occurrences of Each Word in Column using UiPath ?
Knowing that, I have found the following topic, but here we need to mention which word to count, and in my case, I need to fetch first all items and calculate the occurrence of each one.
Thanks in Advance
Use a for loop and inside that you can count the occurrence of each row
element in loop in a specific column.
dtYourDatatable.AsEnumerable().Count(Function(row) row("strYourColumnName").ToString.Equals(row.toString))
2 Likes
hsendel
November 21, 2021, 6:08pm
3
Thanks a lot @rahulsharma
1 Like
hsendel
November 21, 2021, 9:18pm
4
Hello @rahulsharma , Please tell me, How to include row index in for each loop ? Thx
In the for each activity’s property panel. The last option will be index that will store the index for the iteration of for loop
hsendel
November 22, 2021, 8:11am
6
Hello @rahulsharma , Didn’t get what you mean, could you please share that with simple example. Thx
Click on for each activity
In the property panel → the last option will be og Output. in that you’ll see Index field
Create a variable of integer type and assign that variable to that field
This will Store the row number currently in Loop. For first row, the index variables in will have value as 0 and for second it’ll have 1 and so on
Below screenshot shows that last option is Index
1 Like
hsendel
November 22, 2021, 10:47am
8
Hello @rahulsharma
When I declare this variable and use write activity to print all indexed through for each , I got the following error:
system
(system)
Closed
November 25, 2021, 10:47am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.