Can we directly pass a variable in the selector?

Sure
we got two options
–either while doing data scrapping itself we can choose the NEXT page option which will iterate till the last page
or
if we want to iterate on our own for each page then we need to pass the Pagenumber variable as a input to the selector attribute and we need to increment the page number within while loop
while condition be like this
Counter < PageNumber
and use this while loop within a TRY block of TRY CATCH activity so that if the sequence fails due to no more transaction it will go to CATCH block where we can mention that “There are no more pages to fetched with data” in a log message

Cheers @AryanSingh

@Palaniyappan

I am doing this only but it keeps repeat writing the data. And it not working properly.

may i know what was the issue
Cheers @AryanSingh

@Palaniyappan

Please check the images below:

I am using the index to identify the element

Counter is also working properly. Check below

image

See the marked fields its repeating.

1 Like

Fine
may i know how we are inserting the datatable obtained from data scrapping to the excel
make sure that we have used CLEAR DATATABLE ACTIVITY once after inserting the data to excel for each iteration so that the data is removed and fresh data will be added the datatable while extracting

Cheers @AryanSingh

@Palaniyappan

Thanks. I am using if activity and condition is mentioned as if the counter= 1 then write range other wise append range in the excel. Please check the screenshot below.

@Palaniyappan

Is it okay or should I change the method?

Thank You

@Palaniyappan

I have resolved the issue of duplicate data with your idea. But I am facing another issue.

Not able to extract the data for the last page using the counter but when i increase the one more

like if the page index is 7 then if I use the condition the count < 8 (Then it is not extracting the last page data).

But if we enter the condition like count < 9 (Then it can retrieve the data for the last page but giving me a error since i am using the click activity seperately and using this count to iterate through all the pages using page indices)

Can you guide me what I am doing wrong?

Thanks

Hi All,

Just one thing nobody seem to have mentioned. In never versions of UiPath you can use your variable directly in Selector Editor - just put the variable in double curly brackets {{variable}}

Best Regards,
Filip

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

Details on how to use it here Check this new feature for this! How to use variables in selectors in Studio (dynamic selectors) without string manipulation! - #4 by lakshman

3 Likes