Variables int32 and GenericValue

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

If possible, the Extract Structured Data / Datascraping or Get Text would be more reliable for you. Getting OCR to be accurate takes some skill or better tools like Abbyy

Note: 18.4 allows you to see elements in Citrix, if that is your challenge.

is there some activity in UiPath that i can zoom the web page?
i’ve tried it manually and it increases the accuracy

If it’s a PDF file, use a TypeInto on the Zoom Field. If it’s a website, perform the same keys you did manually with a TypeInto (ie Ctrl+"+") or whatever the zoom keystroke is for you.

does that help answer your question?

And, yeah, adjusting the zoom along with scale in your OCR activity can improve accuracy, but takes time to find the right numbers.