I am using HATS v18.104.22.168 and I want to use $HMLFormatUtil$ class to convert strings to numbers, do arithmetic, then convert the result back to a string to insert into a field. The $HMLFormatUtil$ library has the functions. However, when I use them they fail. Let me explain.
I'm running in the US. I have the following two strings that I want to extract from the screen, add them together,and insert the result into another field.:
I define two macro variables as follows:
<create name="$bal_string$" type="string" value=""/>
<create name="$bal_double$" type="double" value="0.0"/>
I try to perform the following actions:
<extract assigntovar="$bal_string$" continuous="false" ecol="39" erow="11" name="'balance'" planetype="TEXT_PLANE" scol="28" srow="11" unwrap="false"/>
<varupdate name="$bal_double$" value="$HMLFormatUtil.stringToNumber($bal_string$)$"/>
The extract executes, but the macro blows up on the <varupdate> statement. If the fields do not contain commas and if the minus sign is in in front it appears that the logic works; however, the presence of If either results in the <update> action failure.
I spotted the following in the Information center:
The methods numberToString() and stringToNumber() perform conversions between a number (that is, a variable or immediate value of type integer or type double, such as 1111.22) and its representation in the current locale (a string, such as '1111.22', '1,111.22', or '1111,22').
As another example, a negative number such as -78 can be represented as:'-78' '78-'
The way this is worded implies two things:
- The US does not put the minus (-) sign at the end of a number, rather at the front and as such the numeric conversion is invalid
- The US does not use commas in representing numbers.
While the first assumption may be true, the second certainly is not.
Am I missing something here? Where might I find the local rules that this utility is using?