Need Help to loop a Structured Data table in If statement

Hello Uipath community,

I need you help with the following topic.
I data scrap a datatable in a website representing reports I would like to download.
Each line is a report with col 1: the name / col 2: the status (In Progress / done/etc)/ col 3: the date.
I need to loop in this structured datatable and if the date = today And the stauts =done, so i click on the link.
I don’t manage to write the condition in the If statement.

Could you please help me?

Hi @MATRAY_Guilhem,

Run a for loop on datatable(say your datatable name is dt_Test).

then check its columns using below syntax:
dt_Test.Rows( ‘row number’).Item(“Column Name”).ToString

lets say rownumber is 0, column name is colname then it would look like below:
dt_Test.Rows(0).Item(“colname”).ToString
alternatively, you can use column number instead of column name as shown below:
dt_Test.Rows(0).Item(10).ToString

then to add condition for status would be something like below:
if (dt_Test.Rows(0).Item(“colname”).ToString).contains(“done”)
then … further steps in your sequence

Regards
Sonali

Thanks Sonali.
Can you develop how to check the columns of the datatable?
Do I have to use a test sequence?

Thanks a lot for your help, I really appreciate

Hi @MATRAY_Guilhem,

Using the syntax i provided you should be able to fetch column values.

Also, I would recommend going through below course section in ‘RPA developer foundation’ on uipath academy to understand working of datatables in a better way.

Link to the course:

Regards
Sonali

Hi Sonali,

Thanks a lot.

I tried using your syntaxe:


but it seems that I still have an issue.

I already looked into this course: i will definitely watch it again.

Hi @MATRAY_Guilhem,

Syntax you are using in the screenshot is different from the one I shared above.

Please try using the one I provided and see.

Regards
Sonali

Do you mean replacing “Row” by 0? That works but how can I put this condition into a loop if I cannot put a variable in it?

Sorry, maybe my questions are stupids

Per this, syntax should be somewhat like this:

ExtractDataTable.Rows(row).Item(3).ToString

Please cross check your syntax.

Regards
Sonali

I don’t see any error now. I will continue the next steps.

Thanks a lot for your help!!!

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