How to check if extracted data table does/doesn't exist?

I have two extracted data tables: dt_1 and dt_2

Based on certain conditions, sometimes one (or both) of the tables will (intentionally) not be extracted by my script.

I’d like to write some IF statements based on whether dt_1 or dt_2 exists.

Something like…:

IF dt_1 exists and dt_2 exists Then
Do some stuf

If dt_1 does not exist and dt_2 does exist Then
Do different stuff

Do you know how I could structure that; currently I have

If dt_1 is not nothing AND dt_2 is not nothing Then
Do stuff

But, this doesn’t work, it always returns true even if there’s no dt_2.

Do you know what I could be doing wrong here?

Thanks!

Use for each row and log a row just to check if the datatable 1 have value or not, Assign that value to variable and check if that variable is not equal to spaces- then do a action. Same way , use this in datatable 2. Hope this helps, Happy Automation!

Hello @SentientPizza!

You could try something like this:

If
dt_1.rows.count >0 and dt_2.rows.count >0
Then - > do something

Hope this helps.

Cheers!

2 Likes

Dt is not nothing means the datatable variable has been declared but may still be empty.

As @Nikola_Drazic, mentioned use row count greater than 0 to check for empty datatable.