View source | View content page | Page history | Printable version   

Projects:Support different numeric formats/Howto Upgrade Manual Code



This document describes which changes need to be done to custom code to support different numeric format.

Include order of javascript files (utils.js before dojo.js)

The support for different enhances the dojo RealNumberTextbox widget to support different numeric format. This changes use some common code in the utils.js function which is executed on inclusion time of the dojo.js file. This means that the utils.js file must be included before the dojo.js file (if the dojo.js file is used in some html page). If the dojo.js file is included before the utils.js file then default values for the grouping separator and decimal separator will be used to allow custom non-updated code to still function as before.

Updating UI components

The User interface files needs to be updated to support proper formatting of displayed number (output formatting) and for parsing of number (input parsing). The input parsing changes are different depending on which input widgets are used (dojo-RealNumberTextbo or normal standard html input tag).

Output formatting of numeric fields (xmlEngine)

All numeric fields should be properly formatted using a numeric format specified in the Format.xml file. This should be done independent of the project to properly display the values in the correct format. But is now a requirement to allow the js-code to properly parse the number.

This can be done by using the xmlEngine 'format=<value>' attribute where value is one of the format names defined in the Format.xml file. If specified the format attribute will cause the value to be formatted on output for both the 'Field' and the 'Parameter' tags in a xmlEngine control file.

An example are these changes done to the xmlEngine control file of the 'Report General Ledger'.

Note: Which format name should be used depends on which type of value is displayed in the field, like prices, quantities... The right format should be chosen on a per-field basis.

Changes for dojo-RealNumberTextbox widgets

The dojo RealNumberTextbox widgets need a new attribute defining which format should be applied to a field. The attribute name must be 'outputformat'. The values are again the format names defined in the Format.xml file.

An example are these changes done to the html part of the 'Report General Ledger'.

The format used for the same field in the xml and html part should be obviously the same per field.

If a dojo RealNumberTextbox widget should contain a call to one of these javasscript methods:

then these javascript calls must be removed.

Changes for normal html-input widgets

These non dojo numeric input fields need the following attributes added:

In addition any call to one of these javascript methods needs to be removed:

Possible cleanup of js includes

After converting all numeric fields the following js imports are not longer needed and can be removed from the changed html files.

Changes for backend code reading numeric values

All java code which reads numeric parameters from a HTTP request needs to use special getNumeric* function defined in VariablesBase.

The mapping from the normal get* function to the special one for numeric values is:

This special getNumeric* functions need to be used both for reading values from the changed numeric fields as well as reading of numeric parameters sent to callouts.

An example for using the special GetNumeric* getter functions for reading numeric values can be found in this change done to the 'Report General Ledger'.

Changes to callouts

To types of changes need to be done to custom callouts.

The first one is get usage of the getNumeric* functions for reading of numeric paramters as outlined in the previous paragraph.

The second change concerns the quoting of numeric values in callout responses. All numeric values are not allowed to have quotes around them.

An example for the use of the getNumeric* functions to read the parameters can be found here.

An example for the removal of the quotes around numeric values in the reponse can be found here.

Retrieved from ""

This page has been accessed 2,840 times. This page was last modified on 8 June 2012, at 05:31. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.