Datatable has value or not?

Hi all,

How to find whether the Extracted datatable have data or not ? Is there any way to Find out please let me know.

Yes … you can do it.
Let us Consider you have a Datatable → Dt_Sample then the Expression will be,
Dt.Sample.rows.count > 0

The above Expression will help you to find whether the datatable have null value or not.

Happy Learning !!

Hi @Moni_1234 and @Jayavignesh_G,

Using the above might not work when the datatable is not initialized.
Null Dt will not return rows and therefore the comparision operator has no value to compare with i.e. Dt.Rows.Count will give you an exception with the following message - If: Object reference not set to an instance of an object.

If you actively have ensured that the Datatable is never nothing by using Build Datatable or reading from activities like Read Range then yes, the suggestion from @Jayavignesh_G will work.

A safer check is

Not Dt is Nothing followed by a sub check Dt.Rows.Count > 0 / Dt.Rows.Count <> 0 both > and <> will mean the same as there cannot be counts in negative numbers.

This does two things, it checks if the Dt is NOT Nothing (Datatable is initialized, headers and rows exists) and only when the datatble contains rows will it go to the next sub condition.

There are more elegant ways to do this, above is just a suggestion.

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