How Capture or Fix a RunTime Error?

Hi Guys!

I am getting a RunTime error

I have a DT and I am filtering this data, the ideal case is that always is data, but How can I capture the case when is no data? I mean, is there any way to do a filter and store in some way that the result is no data there?

ideas? thanks


Keep that Assign activity in Try Catch block. If no data then it will come to exception block and will continue with other steps in the process. In Catch block you mention what to do if it doesn’t contains any data.

you should use a IF condition to check for that like this:
IF (DT.Rows.Count>0)

@lakshman I already have it inside a Try Catch, also I tried to put inside a invoke workflow and I put another Try Catch sorrounding this invoke and nothing …


Could you please show me screenshot of your flow once.

I cannot do a screenshot …but … this assign to a DT is giving me error when that filter bring me no data … I am doing this …

DataTable = in_dt.AsEnumerable.Where(Function(row) row(6).ToString= in_dtCompleteData.Rows(in_iRow).Item(“xxx”).ToString).CopyToDataTable

Is working fine when I have data …

yeap I tried too, but also I got that error … I guess is when I am filtering the data …that filter could sometimes bring data or not.


Just place this Assign activity itself in Try block and then try.

I did but not works … is because is a runtime error …that kind of error cannot be capture in a try catch …

this error do not come as a result of the filtering, it is because your first data table has no data, so you put that IF i showed you, BEFORE, the Filter Data Table activity and AFTER as well…


We can capture runtime also. May I know what type of exception you defined in Catch block ? Is it System.Exception ?

my first DT has always data, when I do the filter is when can I have data or not … but I tried another thing with your idea … before copytodatatable I did the count inside an if and that is working! Thanks you!

1 Like

@lakshman thanks for your suggestions …but works the way that @bcorrea said.

1 Like

Just so you know, this is not true.

@lakshman is correct.
If you catch a System.Exception or a System.InvalidOperationException then you will catch this exception.

1 Like

ok thank you …but was other my problem in this case … I didnt need to capture that error …I just needed to fix my code.

Have you tried Isnothing(datatable) ?
use it in if condition . It might help you

dt Is Nothing OrElse Dt.Rows.Count = 0

no, but I already solved it. Thanks

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