Source contains no datarow - solution needed

Hi Team,

I have 2 columns names Empid pass with values and try to apply select using the below query by reading into a DT

DT.Select(“Empid=‘7’”).copytodatatable but it throws an error saying source contain no datarows. Could anyone let me know how to avoid this error if no rows found while comparing the data? Thanks

1 pass
2 pass
3 pass
I tried this query

Hi @Boopathi,

try this in assign statement,

DT= if(DT.Select(“Empid=‘7’”).count=0, new datatable,DT.Select(“Empid=‘7’”).copytodatatable)

dataTable.xaml (5.7 KB) - Sample for your reference.



With DT.Select(“Empid=‘7’”).ToList
You will get Back a list of datarows as the result of the Filtering

Within an If Activity and the condition yourdatarowlistvar.Count>0 you can react on the existing datarows and finally create the Datatable with yourdatarowlistvar.CopyToDatatable

1 Like

.CopyToDatabase will throw error when no data found.
You can use “Filter Data Table” activity and perform your search. when search value not available It will return zero/empty results.