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
Thank you xoxo
September 27, 2018, 3:24am
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
September 27, 2018, 4:19am
Instead of just checking for the count of Rows, Check if (dt3 is NOT nothing), after which check if dt3.Rows.count>0.
September 27, 2018, 4:20am
Try to print the rows count before IF activity.
How do you do this? I tried IsNotNothing(dt3) but does not work
September 27, 2018, 7:14am
In your if condition, write one of these:
dt3 is nothing
Your else part will contain the code for when the table reference exists.
Check this and let me know if this solves your problem.
@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.
September 28, 2018, 1:24am
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)