For loop error handling

hi is this possible if I have 1000 number of records in for loop if any records have error or not a correct format they not stop the application move on next record

2 Likes

Use try catch inside For loop
so that if any error occured catch will be execute and then next loop element

2 Likes

Hi, you can use the Try Catch Activity,where you can even handle errors (or ignore them), just put your code inside it, and the Try Catch inside the Loop :).

2 Likes

Fine
the thing is we can use TRY CATCH but it can handle only the exception to certain extent, may be we even try to go for next iteration in the catch block if any exception occurs in the current iteration in the TRY block. But what to do if any iteration again fails in catch block…we need to concentrate on it
–so we need to have a validation for this either with a IF condition
whether to check any record has error in it or not
–may i know if there are any possibilities like we got to validate the error using IF condition
like the row has no value then we can validate with
String.IsNullOrEmpty(row(“yourcolumnname”).ToString)
if true it will go to THEN part where we can handle that record if not it will go to ELSE part where we can leave it empty without any activities so that it wont process that specific record and move on to next record in the for each row loop

OR
If we feel like any activity will get into exception along the process with those records been passed as input, then we got an option called CONTINUE ON ERROR property in the property panel of the activity which uses those records, and if that property is enabled even if any error or exception occurs it wont stop the process and move on to the next activity within our for each row loop activity

Hope this would help you
Cheers @Aditya10989

3 Likes

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