Format a numeric constant for the correct region

Format a numeric constant for the correct region

Depending on the region settings for your rulebase, the meaning of the comma "," can be as a decimal separatorThe symbol marking the point between the whole and decimal parts of a number. (rather than a full stop ".") or as a thousand separator. The space character " " may also be designated as a thousand separator for some regions. It is important to note that this can affect the way numbers are used in function definitions, since the parameter separator used in functions (ie to denote the different values being provided to the function) is a comma, and spaces are also used to separate the parameters visually.

Consider the following example:

the man’s first initial = substring(the man’s name, 0, 1)

When authoring for a region which uses a decimal point as the separator, this reads as 'the man’s first initial is equal to a substring of the man’s name from position 0 for 1 character'.

When authoring for a region which uses a comma as a decimal separator, the compiler has no way of knowing whether or not the "0," is a number which has not been entered correctly (ie missing the decimal part as in 0,15).

A similar situation can arise with the use of the comma or space character as a thousand separator, when entering larger numbers into functions.

With this in mind, when authoring function rules where ambiguity such as this could occur, numbers used in functions should be encased in further brackets. For example:

the man’s first initial = substring(the man’s name, (0), (1))

Or where the comma is used as a thousand separator:

the product key = substring(the full product code, (2,050), (27))

It can also help to avoid ambiguity if the space characters are used to separate each of the parameters in a function, although this is not a requirement enforced by Oracle Policy Modeling.

Note that this does not affect the use of number variables, only stated constants.

 

See also: