A List of DataTables while looping it always returns empty rows

Fellows, I’m web scrapping a website that contains multiple tables. They are not necessary related, but the automation later on is the same. If I Extract all tables and merge them, I can run my automation “fine.” However, since I need a Dynamic Selector, there are names that are the same in other tables, crashing my automation. That’s why I thought, I could use a List of DataTables and that should be all. However, when I check the values, they are empty and I don’t know why.

This is what I’m doing:

Process:

Variables:

However, when I run it and loop through the result is always empty:

Option 1:

Option 2:

Result:

If I use the merged table like this it works, but I have the duplicated issue:

Do you have any idea what am I doing wrong? Thanks.

Hi @fanmixco

Are you trying to extract each page as datatable or extracting different datatables.

Could you be more specific what you are doing

Several DataTables that are almost the same. That’s why I firstly merged them but then I found there were duplicated elements.

Might be there is an issue with the Extract Table data activity… @fanmixco

Follow the below steps to modify the properties of Extract Table data activity,
→ After indicating the table in Extract Table data activity.
→ Comeback to studio and open the properties.
→ Expand the Target option and open the Fuzzy selector and clear all the selector data.
→ Open Strict selector and copy the selector data and paste it in the Fuzzy selector.
→ In the Targeting methods dropdown check the Fuzzy selector and uncheck the remaining.

By doing this the Extracted data will be extracted properly.

Check the below image for better understanding,

Hope it helps!!

The extract is working. If I merge them as I show is working, the issue is when I use the List of DataTables and try to loop it.

Just a hunch, and I don’t know if it makes a difference:
What’s the type argument set to in the “Append Item to List”-activity, object or datatable?
Try using datatable if it’s set to object.

@fanmixco,

Can you confirm if you selected DataTable as Argument type for this For Each

It should be like this.

I think it’s correct the ocnfiguration:

The image shows a UiPath workflow with nested loops iterating through a list of DataTables and logging each row's first column value. (Captioned by AI)

Or should it be different?

It’s a DataTable also:

I tried before with an Object, and the result was exactly the same.

@fanmixco,

That’s correct! Let me try to recreate this. I will update here!

I was able to fix it. I needed to re-initialize the DataTable before the next scrapping, I don’t know why all data is gone if you don’t do it:

If anyone can explain the “logic”, I’d be glad to know since if I merge it, it works, which makes no sense.

1 Like

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