How to solve the source contains no data rows?

Hello team

I’m getting this error as show in above image

I’m iterating data table with downloaded files by using this below code

“dt.AsEnumerable.GroupBy(function(x) x(“Customer Name”).ToString.ToLower.Trim).Where(function(x) Not x.Any(function(y) y(“Match Type”).ToString.ToLower.Trim.Equals(“confirmed”))).SelectMany(function(x) x).CopyToDatatable”

Code is working but the issue is the when only single row available in downloaded file and that case is ‘confirmed’ that time this issue occurred

This is the file
Again DOC-20231016-WA0016.xlsx (7.3 KB)

@Anil_G

Thanks

HI,

Can you try to use DataRow array (use ToArray method instead of CopyToDataTable) then check it contains any rows using IF, as the following post?

Regards,

1 Like

@suraj_gaikwad

Please try this in if condition

dt.AsEnumerable.GroupBy(function(x) x(“Customer Name”).ToString.ToLower.Trim).Where(function(x) Not x.Any(function(y) y(“Match Type”).ToString.ToLower.Trim.Equals(“confirmed”))).SelectMany(function(x) x).Count>0

and on then side use the normal assign with linq

on else side use arr_dtout = dt.Clone

Hope this helps

You are facing the error because all rows are filtered and no rows are present to copy to datatable

cheers

1 Like

Thank you

@Yoichi
@Anil_G

1 Like

:ambulance: :sos: [FirstAid] Handling of The source contains no DataRows exception - News / Tutorials - UiPath Community Forum

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