Specific rows index

Hello !

How can i get the index of all rows in a data table which contains specific value.

For example the index for all rows that contains the text “Approved”.

Thank you in advance !

1 Like

what I can think of right of the bat is to put the data table in a for each row activity. here the activity will do a search for the text “approved” there will also be a counter running which for each loop will increase by 1. we will write the value of the counter where approved is found. this counter value will be the row number

@Dragos_Padurariu

Hope it will helps for you.

If it is possible try the code like in the uploaded xaml

Main.xaml (6.6 KB)

Let me know if you need any details

Thanks,
Pradeep Sridharan

i just tried this but it doesnt show the row number, am i missing something here?

Almost, you need to identify the index of the rows which contain “approved”

image

dtTest.rows.IndexOf(row).ToString

Main (6).xaml (8.0 KB)

1 Like

not working … giving incorrect row number

In the test datatable there are three rows which have “Approved” as their data:

image

The code prints the index of the rows which contain the text “Approved”:

image

If you wish to have row number rather than the Index, then it is simply a matter of +1 to the output each time.

if i am not mistaken the OP wanted to get the index of all the rows in the data table with approved. so basically your data table will be 1, 3 & 5

My mistake, I hadn’t noticed that @Pradeep had already filtered out the invalid lines which did not say “approved”

updated

Main (6).xaml (7.2 KB)

image

1 Like

i guess this is it :slight_smile:

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