How to handle "The source contains no datarows" exception?

I am performing filtration on a data table but if in some cases there is no match I got the exception
“The source contain no datarows”
I know there is a solution on the forum using the LINQ query but is there any other more simple way to deal with this
Here is my workflow(But I am still getting the same exception if there is no match
Filter DataTable.xaml (8.5 KB)

Hi @Sami_Rajput

Please see the attached xaml I modified accordingly

Filter DataTable.xaml (11.1 KB)

You need to first do a count of values returned and then use copytodatatable

cheers

1 Like

@Sami_Rajput

With the DataTableVar.Select Method we can do it similar
in_DT_to_filter.Select("[Date] > '"+in_Date+"'").ToList

2 Likes

Hi @Anil_G,

Thank you for your answer.

Can you also explain the approach you used? Attaching the .xaml file without explanation will deter other forum members duplicate the answer.

You could take a screenshot of the workflow with annotations in the code to achieve this.
Downloading and opening an .xaml file to see if the alternative solution exists is going to waste time for forum members and future readers.

Hi @jeevith

Sure i will include more explanation. generally in other posts i followed the same approach. Even here i gave an explanation but a very little in single liner. But thanks for bringing this up will include these suggestions for the future comments

Cheers

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