Exception handling using Try Catch block


Here is my excel file.
I need to do this using Try catch block only
Note: not to use If or any decision activities.

I need the difference between In value and Out value columns row by row and print the result in Difference column.
If the In value is not a number, write instead "In wrong.
Otherwise, if the Out value is not a number, write instead “Out wrong”

Experts plss help!!

hey,
I’m not sure why you want to do that. You can use two try catch blocks
commTry.7z (45.2 KB)
But in my perspective it will be better if you will check if variable is numeric this way:
image

Hi @Tabbu ,

After reading range, set up a for each row in table loop . Then in loop body set the try catch

In try add new variable int = Int32.Parse( CurrentRow(“In”).ToString)-Int32.Parse( CurrentRow(“Out”).ToString)

If exception assign CurrentRow(“Diff”) =“Out wrong”

Aftter all rows are processed, write range back to file.

The requirement is like this only.But we cant use if condition in whole process

But where is the situation if the value is not numeric

It is when you have characters inside numeric value like in your example:
123 - is numeric
11a - isn’t numeric

and check my workflow with two ‘try catch blocks’.

1 Like

o right : then like @pikorpa showed use 2 try catch in the for each row loop.

And then assign a value with the Int32.Parse( CurrentRow(“Out”).ToString)

If it catches it is not numeric

Just curious: why the restriction of not useing if-statements?

Thank you so much much much!!!.This helped me alot

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