Creating and Initializing Fixed Decimal Values
Instead of just initializing variables or attributes in scripts with numbers, as is done with Floating Point decimals, Fixed Decimal values are Java Objects that need to be created using the ScriptUtil.createBigDecimal() factory method.
For example:
var dTotalKgs = ScriptUtil.createBigDecimal(0.0); var dTotalKgs = ScriptUtil.createBigDecimal("0.0"); |
The value passed to the factory method can either be a JavaScript number (or a BOM Floating Point attribute value), or a quoted string (or a BOM Text attribute value). In most cases, it is best to use a Text parameter, which is converted to the exact number, whereas some small errors can occur when using numeric parameters, especially if the values are large.
Copyright © Cloud Software Group, Inc. All rights reserved.