I have a data table somewhere in the middle of my flow I want my workflow to terminate if the datatable is found to be empty.
If dtFiltered is found to be empty the workflow should terminate.
I have a data table somewhere in the middle of my flow I want my workflow to terminate if the datatable is found to be empty.
If dtFiltered is found to be empty the workflow should terminate.
Do you want proceed with next workflows by skipping current workflow if DataTable is empty ?
If yes then surround that assign activity inside Try Catch block and in Catch block use Throw activity to throw the exception outside to skip the remaining steps in the current workflow.
Please use below expression for the same.
dt.Rows.Count =0 Then terminate the workflow.
No I don’t want to proceed with the remaining steps in the current workflow
Use this:
dt.Rows.Count =0 Then terminate the workflow.
The Error will be thrown on The Assign Activity How do I handle that error ?
If yes then surround that assign activity inside Try Catch block and in Catch block use Throw activity to throw the exception outside to skip the remaining steps in the current workflow.
Hey Can you please paste the right side statement which you assign? @Ishan_Shelke1
dt.AsEnumerable.Where(Function(row) CDate(row(dateColumnName).ToString).Date.ToString(“dd-MM-yyyy”).Contains(date1) andAlso Not(row(12).ToString.Trim.Equals(“Cancelled”))).CopyToDataTable
dt.AsEnumerable.Where(Function(row) CDate(row(dateColumnName).ToString).Date.ToString(“dd-MM-yyyy”).Contains(date1) andAlso Not(row(12).ToString.Trim.Equals(“Cancelled”))).CopyToDataTable <> 0
Use above statement in if condition and then do the assign activity inside it.
Hi,
I think it’s better to use ToArray instead of CoptToDataTable, because it throws error if no source rows. then check its length as the following.
Note: arrDr is array of DataRow
Regards,
It’s giving error as Operator ‘<>’ is not defined for types ‘System.Data.Datatable’ and ‘Integer’
Hi Ishan,
Sorry my bad please use below one.
dt.AsEnumerable.Where(Function(row) CDate(row(dateColumnName).ToString).Date.ToString(“dd-MM-yyyy”).Contains(date1) andAlso Not(row(12).ToString.Trim.Equals(“Cancelled”))).Count <> 0
It giving me an error as Value of Type 1-dimensional array of System.Data.DataRow cannot be converted to System.Data.Datable
Still Throwing Error at assign activity
What’s the error? @Ishan_Shelke1
Use the above statement in if condition if that condition is true then use your expression in assign activity.
I hope this is clear. Do it like below.
Thanks!
Hi,
Can you define arrDr as DataRow[]
in variables panel?
Regards
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.