How to get counter position of a given element?

Hi guys,

I’m currently working on an automation project, where I need to get the counter position form a given element in a datatable.
My brain is currently not working, and I would love it if some of you could give me some advice.

Thanks in advance!

@PrincessSof
Welcome to the forum

grafik

grafik

grafik

find some starter help here:
FindIndex_FirstLastAllMatch_1Col_1Val.xaml (8.7 KB)

In case of your implementation is doe within a for eah / for each row you can refer to the index out as well:
grafik

3 Likes

Hi @ppr, thank you :wink:

Why do you place it in an array tho?

I assume you are talking about the AllIndex case. When we expect multiple rows matching the evluation we have to handle multiple returned indexes. Therefore we used the array

Maybe you case has some specifics:
where I need to get the counter position form a given element in a datatable

feel free to share some more details on this with us

In case of you want to search dynamicly in columns and or rows find a starter help here:
GetAllRowColIdx_By1Value.xaml (10.7 KB)

Hi

Do you mean like you want to know the row column position based on a input value

@PrincessSof

@Palaniyappan Hi, yes kind of.

I’ll try to explain. I have a table in a given system. I further datascrape the table, and need to get a specific number from the table. From there on I need the row column position for the specific number, in order to continue with the automation task.

Did that make any sense?

Hello @PrincessSof

For this you can use “lookup datatable” activity.

Below it the activity screenshot:-

using this activity you can get the columnIndex/rowIndex of the respective value from the dataTable.

Documentation Link for the same:-

Mark as a solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

above will handle this

or as an alternate

yourDataTableVar.asEnumerable.toList.findIndex(Function (x) x.ItemArray.Any(Function (v) v.toString.trim.Equals("YourSearchTerm")))

grafik