Problem with conversion from string value to number value


#1

Hi Team,

Currently we are getting error when we try to convert string value to number value.

We use this conversion in below format
Using 2 Clipboard actions
1 - Copy variable value to clipboard (String)
2- Set variable FROM clipboard: (num)
but we are getting error on second step.


#2

@dipti_shrivasta
You can get an error due to lack of type casting, i.e. when setting a string value to a number variable or when a value being set contains the invalid decimal separator.
Please let us know what value you’re trying to copy and set?


#3

we are taking 2 as a string from OCR we need to convert it into number.


#4

@dipti_shrivasta,

See the example below:

If you have some error, then the OCR action returned some additional symbols (spaces, etc.). You can try to use the Trim Whitespace action - https://kb.workfusion.com/display/RPAe/Text#Text-TrimWhitespaceTrimWhitespace

Or make the OCR area smaller.


#5

Hi,

Our OCR area is very small as you can see below ::

Also when we print this string on notepad, we are getting 2 as string without any space.
So, again tried the same thing for conversion and getting below error.


#6

what is the purpose of the action #5? Maybe try to disable it.


#7

Disabled that step then also getting the same error:


#8

Try to paste your clipboard content to Word and enable the hidden formatting symbols. You will get something like this:

Currently, our Trim Whitespace is not trimming this symbol (or other garbage symbols returned by OCR). We will introduce the Trim by Regexp in one of the next releases.


#9

as a workaround, you can remove the first symbol from your string


#10

Thanks @azinchuk,

This workaround is helping me to read my number :slight_smile:


#11

Hi @azinchuk,

Can you please let me know in which release, “Trim by Regexp” will introduce.

When I take smaller part( i.e, 1 digit) for OCR, it runs fine but if i take bigger part( i.e, 3 or 4 digit number) for OCR, it throws error.
I removed the first symbol from my string then also it wouldn’t work :frowning:


#12

Thanks for your idea! Cannot tell you the exact date, but we will definitely implement this improvement. Your votes can speed up this process.