Variables int32 and GenericValue

Get Full text gives string as output. You will first need to convert to Int32. Do that for both your cases

use Convert.ToInt32(dt1) in assign to get it as an int variable

Then when both variables are int you perform the subtraction in assign activity and store the result in another int variable (or directly convert the result as string in the same assign)

Finally if if your result variable is already string then use that in message box. Else use .tostring to convert it to string from int

2 Likes

Both the d1 and d2 should be integer. Please convert to integer before subtraction.

1 Like


is it correct? when i try to change the var of “dt1” and “dt2” on the variables pane at the bottom of the studio the error says ‘ToInt32’ is not a member of ‘String’

the method is >> Convert.ToInt32(dt1) not Toint

:slight_smile:

8
still, am i miss something?

Please Read This:

and this:

ok, i’ve try "Int32.Parse(dt1), "Integer.Parse(dt1) it fail and the output was Input string was not in a correct format
i’m try to use “CInt(dt1)” and the output is Cannot convert Generic Value to System.Int32

your dt1 variable type is generic. change that to string :slight_smile:

i’ve tried before, the output was Conversion from string “” to type ‘Integer’ is not valid

upload your workflow here please the part where you are getting the error

Exercise.xaml (23.6 KB)

is it problem if the format number that i take like this “424.300,00”?

Exercise_Edited.xaml (23.3 KB)

Added variables for that part… no errors for me…

where is variable that you add? it’s same as mine, you change the dt1,2,3 variable into string right?

yes and the others to int as required. No errors for me in assign

yea, in assign actually there is no error. error showed up when i run the program

yes because its a float /double value on converstion from string and not int because of the decimal

so, it’s because the format of number that i take was double type/value?

You will get this error: “Conversion from string “” to type ‘Integer’ is not valid”
because either the value that was extracted was empty or the string is not in a number format. If it is in a correct Double format, it will still work… it just needs to be a number.

It is good practice to check the string if it is a number before conversion. You can check this using the condition: IsNumeric(dt1)
But, you also want to make sure your extraction of the string is working as intended so it’s not a coding issue causing this.

Sometimes to avoid clutter, I will use an inline If condition which would look like this:
If(IsNumeric(dt1), Convert.ToInt32(dt1), 0) + If(IsNumeric(dt2), Convert.ToInt32(dt1), 0)
so, it uses a Zero if the value is not a number. Also, keep in mind that 123.000,00 is not in the correct number format since the comma and decimal are in opposite positions, but like for me I don’t convert numbers in that format much since I’m used to the US formats.

Hope this info adds to your solution.

Regards.

1 Like

sorry for late reply, ok thanks i understand.

can you give me another solution to detect the format number? i’ve tried using “Get OCR Text”, and it works by add DeniedCharacters in properties (,) and set profile to scan but the problem it doesn’t accurate 100% and every number have different scale to detect