Variable conversion for calculation

Hello all. I need to do a multiplication of 2 numbers (which are percentages) gathered from different locations.

For example, if the 1st number gathered is 57, and the 2nd is 49.

The robot should be able to calculate 57%*49%. So the Result should be 27.93%. I will then need the result as string type.

Currently, I get the numbers as string type, say Num1 & Num2. Then, I am not sure what I should assign Result to be to do the calculation.
It doesn’t work to assign Result = Convert.ToInt32(Num1)*Convert.ToInt32(Num2)/10000 and set Result as Decimal type. Then output Result.string.

Please help…

Did u provide result.Tostring as output or result.string ?

What error is throwing when u assign like that @wth1993

Hi @wth1993

Can you try as below :-

Double Result = (CInt(Num1)*CInt(Num2))/10000

Note :- % Sign must not be der with Num1 & Num2

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

2 Likes

You have a type issue. You can’t multiply 2 integers, then divide all in the same assign activity. If you change the Result variable to a double, then you can do it but not when it’s a decimal. The easiest solution would just be to change the result variable to double. If you want to keep it as decimal, then see the attached workflow: delete2 - Copy.xaml (5.8 KB)

2 Likes

Thank you two for solving my problem!

1 Like

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