Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

The following rules are applicable for both form fields and grid cellscolumns.

 

The default format for numeric fields in Form/columns in Grid is the one specified in the PASOE configuration file, in these fields:

  • globalNumericFormat – 0,000.00
  • globalNumericGroupSep – ‘.’
  • globalNumericDecSep – ‘,’

 

There are three attributes for these fields that are important:


extendedFormat attribute

A custom format can be specified by setting the ‘extendedFormat’ attribute in the corresponding field. If the attribute is set, it will overwrite the default values (or parts of it).

The ‘extendedFormat’ attribute has the following format: ‘format|groupSep|decSep|maxLength|minVal|maxVal’ (e.g. 0,000.00|’|,|6).

The format must always use as separators the ‘,’ for groups and the ‘.’ for decimals. The format specifies the number of digits in a group and the number of digits for the decimal part. Examples:

  • 0,000.00 will display groups of 3 digits and 2 decimals  
  • 0,00.000 will display groups of 2 digits and 3 decimals
  • 0,000 will display groups of 3 digits without any decimals (so only the integer part)

The ‘extendedFormat’ attribute can then be specified like this:

  • 0,000.000 – only specifying the format and using default separators
  • |- - only specifying group separator and using default format and decimal separator
  • |-|’ – only specifying group and decimal separators and using default format
  • 0,000.00|-|, - specifying all fields (e.g. 1234,567 -> 1-234,56)
  • 0,000|’ - displaying only the integer part and specifying the group separator (e.g. 1234,567 -> 1’234)

There is also a possibility of adding currency or displaying a percentage value, like this:

  • $0,000.00|,|.  - 1234,567 -> $1,234.56
  • 0,000 Rub  - 1234,567 -> $1,234 Rub
  • 0,000 % - 12,37 -> 12%

By default, an integer/decimal field will support negative and positive values. For allowing only positive values in a field, the ‘extendedFormat’ attribute needs to start with ‘+’.

            +0,000.00|-|,  - will allow a user to enter only positive values

The maxLength parameter is optional and it limits the number of digits allowed to be entered before the decimal separator. if it's not specified, there is no limitation. 

  • 0,000.00|-|,|4 - specifying all fields (e.g. 1234,567 -> 1-234,56)
  • 0,000.00|-|,|6 - specifying all fields (e.g. 123421,567 -> 123-421,56)

The minVal and maxVal parameters are optional and it specify the minimum and maximum value accepted for the numeric input.

  • 0,000.00|-|,|4|10|1000 - a number between 10 and 1000

 

(info) Starting with SWAT Release 2019.22, you can specify the extendedFormat also as a JSON object. The backwards compatibility is kept.

  • {"format":"","groupSep":"","decSep":"","maxLength":"","minVal":"","maxVal":""}

isCurrency attribute

The default currency symbol is the one specified in the PASOE configuration file in the following field: app.sessionData.mainCurrencySymbol

If the ‘isCurrency’ attribute is set for a field in Form/column in Grid, then the field will be displayed with the default format and the mainCurrencySymbol will be added in the field.

If both the ‘extendedFormat’ and ‘isCurrency’ are specified for a field, then only the ‘extendedFormat’ will be used. In order to add a currency for this field, the user must set it in the ‘extendedFormat’ (e.g. $0,000.00).

 

DATA-TYPE attribute

This attribute can be either Integer or Decimal. If it’s integer, the default format will be the one specified in ‘globalNumericFormat’, without the decimal part.

For integer fields, the user will not be allowed to set decimal values.