Roundoff in uipath

How to fix the issue like input string is not in correct format
roundoff all.xaml (12.6 KB)
while roundoff a column values which contains all types of data values.

Hi @anjani_priya

Please try this expression instead:

roundedValue = Math.Round(Convert.ToDouble(currentrow("col1")), 1)

Hope this helps,
Best Regards.

i got same error even though iam using math.round

Hi,

Can you also share your input file and expected result as file?

Regards,

Book2.xlsx (20.8 KB)
input sheetname - roundoff
expected sheetname - round

HI,

Can you share why 234323 becomes 2343?

Regards,

Hi @anjani_priya

you can try this way also
your_variable= Math.Round(“value”, 1)

image

Except the above, the following expression will work as you expect. Can you try this?

Math.Floor(convert.ToDouble(currentrow("col1"))*10)/10

Regards,

@anjani_priya

You are getting the error ‘Input string is not in correct format’ because of the presence of string data, upon which the double function cannot be incorporated.

Please use the following if else condition to filter out such data & roundoff the numeric data only:

System.Text.RegularExpressions.Regex.Matches(CurrentRow("col1").ToString.Trim,"[^\d.]").Count

image

Hope this helps,
Best Regards.

In my input data, strings are present so that I have used try catch block to catch the exceptions.
But the try catch is not working.

Same error .Its not working

Hi,

Did you run debug mode? if so, can you try to turn on ContinueOnException in ribbon menu then debug run?

Regards,

@anjani_priya

As you have not placed any activities in the Catch block in the XAML that you have provided, it looks like the control is not going inside the block. Please place any activity in the Catch block, as it is working fine.

Hope this helps,
Best Regards.

yeah it worked out.Thankyou

1 Like

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