Number field types

A number field type stores its value as a specific Number java type. It is usually visualized as a textbox.

The following number types are available:

Type Java type Remarks

number

Long

Ranges from -9223372036854775808 to 9223372036854775807.

number(byte)

Byte

Ranges from -128 to 127.

number(short)

Short

Ranges from -32768 to 32767.

number(integer)

Integer

Ranges from -2147483648 to 2147483647.

decimal

BigDecimal

Two decimal points precision.

decimal(X)

BigDecimal

X decimal points precision, eg decimal(4).

currency(Y)

BigDecimal

Two decimal points precision with a currency formatting for currency Y, eg currency(EUR).

currency(Y,X)

BigDecimal

X decimal points precision with a currency formatting for currency Y, eg currency(USD,4).

percentage

BigDecimal

Percentage formatting without any decimal points, e.g. 57%.

percentage(Y)

BigDecimal

Percentage formatting with a Y multiplier. E.g. percentage(100) with a value of 24% will be persisted as 0.24 (24 divided by 100).

percentage(Y,X)

BigDecimal

Percentage formatting with a Y multiplier and X decimal points. E.g. percentage(10,2) with a value of 24,12% will be persisted as 2,41 (24,12 divided by 10).

Example number field (age)
document-definition:
  name: person
  content:
    - id: name
      type: string
    - id: age
      type: number(byte)
Example decimal field (temperature)
document-definition:
  name: location-temperature
  content:
    - id: location-name
      type: string
    - id: temperature
      type: decimal(1)
Decimal types are always stored with the full decimal precision in the actual document. The configured precision (2 points by default) only applies to the form controls and rendering of a value.

A number type can also be used as storage type for an enumeration.