How to check if datatable has no rows?

Hi, I would like to filter the rows.

gue.Select(“[Client] like ‘“+Name+”’ AND [Agent] like ‘DB2’ AND [Type] like '”+service1+“'”).CopyToDataTable

The agent is not fixed. It’s either ‘DB2’ or ‘SQL Server’.

So when I hardcoded the agent to be ‘DB2’, the error was thrown to the assign that the source contains no datarows.

I would like to look for this row this value, if it is not true, find another value.

Below is a sample of the dt

I tried this : serviceCatalogue.Select(“[Agent] like ‘SQL Server’”).Length > 0 - but does not work


Any solutions?

Thank you xoxo


Below method will return the rows count


To check datatable has rows

yourdatatable.rows.count > 0


Hi, your solution isn’t working. The error is still there

Instead of just checking for the count of Rows, Check if (dt3 is NOT nothing), after which check if dt3.Rows.count>0.


Try to print the rows count before IF activity.

Hi @siddharth

How do you do this? I tried IsNotNothing(dt3) but does not work

In your if condition, write one of these:

  1. dt3 is nothing
  2. isNothing(dt3)

Your else part will contain the code for when the table reference exists.

Check this and let me know if this solves your problem.

Hi @sangasangasanga,

Try this…



Hi guys @ranjith @siddharth @balupad14, I tried all your suggestions. It was not working. Then I realized the problem isn’t in the ‘for each row’. It is the assigning of the filter rows. I have updated the question again. Pls take a look and help me if you can.

Thank you.

split CopyToDatatable expression in two steps

First Array(of Datarow) filteredRows= gue.Select(“[Client] like ‘ “+Name+” ’ AND [Agent] like ‘DB2’ AND [Type] like ‘”+service1+“’”)

Than assign newDt = If(filteredRows.Any, filteredRows.CopyToDatatable, gue.Clone)

1 Like