The source contains no data rows error

Hi Team,
I have many sheets in excel file, i would like to read all sheets at one shot and filter column in sheets and need to send email if there is no data rows found after filter.

we need to filter date column, lets say if there is no data entered in sheet for last two days in date column then we need to send email.

i filtered first sheet using below commands and got this error the source contains no data rows error

todaydate Today
newtodaydate CDate( todaydate).ToString(“MM/dd/yyyy”)

Lastday Today.AddDays(-2)
NewLastday CDate(Lastday).ToString(“MM/dd/yyyy”)

dt1 dt_output.Select(“[Date] <= #”+newtodaydate.ToString+“# AND [Date] >= #”+NewLastday.ToString+“#”).CopyToDataTable

it seems i am getting this error because i have no data in sheet after filter.

i kept send smtp mail activity in catch section to send exception in mail but mail also not triggering.

could you please help me to solve this problem.

Thank You.

This is pointless. You’re converting the datetime to a string then back to a datetime. Achieves nothing.

Same for “NewLastday CDate(Lastday)…”

A Try/Catch is a good way to deal with this error. What do you mean “mail not triggering?” Show us your Catch.

Hi @postwick,

Thanks for your reply,

in catch section i used send smtp activity to send email if any exception occurred. i have mentioned server datils correctly in properties.

we do handle empty filter result defensive by following pattern:

does mean we check before copytodatatable if rows are present or not as Copytodatatable throws this exception. rows.Count > 0 Then YourDataRowListVar.copytodatatable Else Clone the datatable

about the filtering, Values Conversions e.g. crosscheck so that not an error results to an empty result and ensure the correctness of the expression

Hi @ppr,
Thanks for your reply,

I will try this and let you know. we are missing something in then section assign activity. can you give me what to mention in then section assign activity.

refering to the screenshot
Then: dtDuplicates = drDuplicatesOnly.copytodatatable

dtDuplicates | Datatype: DataTable
drDuplicatesOnly | Datatype: List(Of DataRow)

I have followed same, but still getting error. please let me know if i am doing wrong.

here dtITOperations is input data table which is having data from readrange activity.

It is needed that you adopt the pattern to your case. Copy & Paste will not fix.




Hi @ppr,

Issue has been resolved now, Thank You for the support.

i have many sheets in excel and i have to perform this on all sheets. i will check on that.

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