Iterate each row

Hi All,

i am facing issue while iterating each row.

what i m doing
Step 1going to link where internet data table is there
Step- 2 scraping the data
Step 3 stored in output datatable
Step- 4 taking it in loop

Step 5 double clicking on each row

but the step 5 is not working and it is clicking on same row everytime.

image

image

note- data is spanning into multiple pages.

Any help would be appreciated.

You need to modify the selector for the double-click activity so that it increments to the next row.
With data scraping, you only read the values, but looping over that scraped table won’t automatically iterate through the internet table on the browser.

Look at the selectors for

  • Lours Meyer, and then
  • Thriveni NS

See how they are different (open UiExplorer and look for aaname or id or something that is different but consistent)
For example,
id = "row1"
id = "row2"
If you see something like this, then you can use the CurrentIndex property of the for loop to find the correct cell to click on during each iteration.

Hi @RPAForEveryone,

Thanks for your reply.

in my case the Parent id is changing every time as you can see below.

i changed with * and tried but not working.


Any solution?

what happens if you deselect “parentid” on the right side (checkboxes)

Hi,

if i deselect Parent id and it creates below selector

image

but still clicking on same row.

if you select tablerow now it should be a really nice selector :wink:

1 Like

Hi @Rakesh_Tiwari

As @mwerner suggested, in this case, tableRow is as good a unique attribute as any.
Notice it present as just a single digit (2 and 3 from your screenshots) while the tableCol is 5 in both cases - which would be the element you want to double-click.

  1. Include tableRow and tableCol in your selector and get rid of other random-value attributes such as parentid, idx, etc. TD could be left in as it’s indicative of the HTML component.
  2. Use CurrentIndex to match the selector row index. CurrentIndex is a readily available variable in for loop (you can find it in properties panel of For Each Row)
  3. Use variable syntax for selectors (which is {{variableName}})
    e.g. tableRow='{{CurrentIndex}}'

here i get the table row below image
image

Now, how can i change it so that it takes dynamic row like row 1, row 2, etc…

I think we simultaneously posted :slight_smile:
Please refer to my comment above, hopefully it helps clear the approach a bit.

Hi,

Thanks for your continuous support, kindly let me know where i am doing mistake.

Thanks

why is there a 2 behind {{sCurrent…}?

{{sCurrentIndex}}2

i changed it, but showing validation error

Since you’re going with a dynamic selector, the validation logic may not work like the usual standard selector without variables.

Debug the code and see if it works. If it gets stuck, while in debug, open the selectors and try to see if something pops up as odd.

After debugging it , i can see that in To Field, it showing same as value field as it should show variable name i.e- sCurrentIndex.
Any Suggestion?

image

You have declared
sCurrentIndex = "outDt.Rows.IndexOf(row) + 1" where the right hand side is a literal String. This won’t get you the expected value.
You would want to use
sCurrentIndex = outDt.Rows.IndexOf(row) + 1

In fact, you shouldn’t have to use it or increment it.
The For Each loop gives you the index readily in this property:

Use this to initialise sCurrentIndex and it should work.

Hi,
I think i stuck.

When i am initialize the value as “2” in output property it is not taking.

kindly write the syntax, so that i can understand, please.

Thanks

Hi @RPAForEveryone

Any suggestions?

You don’t have to initialise with a value. You need to specify a variable there which will auto-increment as the for loop executes.

For example, specify sCurrentIndex as the variable in Output property. (Make sure that it is of type Integer otherwise compiler will complain)

Then, as the for loop runs, sCurrentIndex will get a value automatically.
Check the value, if it’s not exactly corresponding to the selector value, find the difference and use it.

For example, since your table has a header, the column header will have tableRow = ‘1’, and hence your first record has tableRow = ‘2’
Although when you iterate on your table, the first row will probably start with index 0, so the loop will set sCurrentIndex = 0.

To match your first row in the table on your webpage, use temporary addition to get the right value:
tableRow = '{{sCurrentIndex + 2}}'

Hi,

i changed as you suggested, but got the error.


Any is missing?