I am trying to make my process continue running even though the data table contains no rows. Here is what I did:
In my if condition its:
dt_Output.AsEnumerable().Where(Function(row) Not (String.IsNullOrEmpty(String.Join(“”, row.ItemArray)))).CopyToDataTable() Is Nothing
If this is true then it will assign rowCount to 0. However right now it will crash at this part with this error output:
How can I make it so that it will continue running?
Assuming you have a DataTable variable named dt in your workflow.
Add an “If” activity to your workflow.
In the “If” activity’s condition, use the expression dt.Rows.Count > 0. This condition checks if the DataTable dt has any rows.
Inside the “Then” section of the “If” activity, place the actions you want to perform when the DataTable is not empty.
If you want to add specific actions for when the DataTable is empty, you can add an “Else” section to the “If” activity. Inside the “Else” section, place the actions you want to perform when the DataTable is empty.
Optionally, you can also use a “Log Message” activity inside the “Else” section to log a message indicating that the DataTable is empty.
When we use read range workbook activity to read the excel, when there is no data in the excel it will throw the exception. If we want to handle this situation
Take the Use excel file activity and insert the read range activity inside.
After the read range Insert place If condition and check the Datatable.rows.count=0
Then you can insert the activities to proceed further.
else you can insert the activities to process further if it have rows.