[Ui automation-data grid]Get a row index basing on columns values from a data grid

Hello,
I need your help please.
I need to get a row index from a data grid in my application basing on 2 columns values(present in the same data grid).
Which activity should I use, and how should I set the parameters please(set the values of the two columns as input)?
And in general is there any package to install to have the activities to use with a data grid(gui automation)?
Thanks in advance .

Hi

Welcome to uipath community
–we can use data scrapping option from design tab and get the data grid as a datatable here in our studio
for more info on this


–once getting the output pass that as input to a for each row activity and inside this activity we can get the index with a simple if condition (as you want to validate with 2 columns) and a assign activity
like this
use a if conditon like (you can have your own condition, this is just an example)
row(“yourcolumnname1”).tostring.contains(“the value you want to validate”) AND
row(“yourcolumnname2”).tostring.contains(“the value you want to validate”)

and if the condition passes it will goto the THEN part where we get the index with a assign activity like
out_index = yourdatatablename.Rows.IndexOf(row)
where row is the variable from for each row which has all the values in the current row under iteration

hopethis would help you
kindly try this and let know for any queries or clarification
Cheers @hanen

Thank you @ Palaniyappan for your reply and help.
I tried to do as you recommended. But I got a problem with the returned result of the data scaping.
In fact, the default returned object’s type is " generic Value".It’s not a datable on which I can apply this for example: object.Rows.IndexOf(row)
image
When I change it to “System.Data.DataTbale”, I got this exception.
image
While debugging, I found that the returned content of the list is null.
Could you help me please?
Thanks.

1 Like

Actually we need to use Data scrapping but it seems like you have used get full text
and that would give us a string or generic value as output and not the datatable
image

Cheers @hanen

Hello @ Palaniyappan
Actually, my grid is an element wpf.
When trying to use the data scraping, I got this error


I’m trying to use the find children activity also.
The Output type should be System.Collections.Generic.IEnumerable but when I want to set this type for my output variable, I 'm having this error

Hanen