Field types

Number

Field types decimal (five decimal places) and int (integer). Both share input and configuration; they differ in their storage form. Data entry from the cataloguer’s side is described under Number .

Three number fields in Moliri: Höhe (height) 110, Breite (width) 140,5 and Tiefe (depth) 8,5, each with the unit cm at the right edge of the field

Units

What is displayed is stored value × factor. The unit with factor: 1 is the base unit, the one the value is actually stored in.

Example Result
JSON
{
  "units": [
    { "unit": "mm", "factor": 10 },
    { "unit": "cm", "factor": 1 },
    { "unit": "m",  "factor": 0.01 }
  ],
  "default_unit": { "unit": "cm", "factor": 1 }
}
Number field Höhe (height) with the value 110 and the unit selection open: mm, cm (chosen) and m
The field Höhe (height) from the demo collection: stored in cm, with mm, cm and m to choose from; cm is preselected.
Unitfactor120 stored shows
mm101 200
cm1120
m0.011,2

Set the base unit once and do not change it again. Giving factor: 1 to a different unit later shifts the meaning of every stored number. Which unit a single object has chosen is recorded in its modifier 1, not in the value.

CaseConfiguration
Simple number fieldnone, the default mask applies
Fixed unit without a choicea single unit in units, or only default_unit
Choice of unitsseveral units in units, plus default_unit

Under Parameters the form maintains units and default_unit together, so that no preselection can arise that is missing from the list.

Currencies always with factor 1

For amounts of money every currency gets factor: 1. Exchange rates fluctuate, and an amount stored after conversion would be wrong later on.

The wall planner reads measurement fields through their unit and needs a resolvable millimetre factor for that. A measurement field without a recognisable unit is skipped there.

Input mask

The mask follows imask.js . Its keys sit flat in the configuration or grouped under imask. A partial entry such as {"scale": 2} is completed from the default.

KeyValuesIf omittedEffect
scaleNumber2 (for int 0)Decimal places shown. For int only 0
thousandsSeparatorone characterspaceThousands separator
radixone character,Decimal separator
mapToRadixList of characters[".", ","]Characters that count as the decimal separator when typing
padFractionalZerostrue, falsefalsePads the decimal places up to scale (in the form only for decimal)
normalizeZerostrue, falsetrueTidies up leading and surplus zeros
signedtrue, falsefalseNegative numbers allowed
min, maxNumberno limitInput limits
unitsList of unit/factoremptyUnits, see above
default_unitunit/factorbase unit, otherwise the only unitPreselected unit. The form under Parameters sets it itself if none is chosen

The field “Gewicht” (weight) in the demo collection combines units and mask:

Example Result
JSON
{
  "units": [
    { "unit": "g",  "factor": 1 },
    { "unit": "kg", "factor": 0.001 }
  ],
  "default_unit": { "unit": "g", "factor": 1 },
  "scale": 2,
  "radix": ",",
  "thousandsSeparator": " ",
  "padFractionalZeros": false
}
Number field Gewicht (weight) in Moliri during entry: the number 12 500,5 with thousands separator and decimal place, followed by the unit g
The stored value is 12500.5. The mask uses a space as thousands separator and a comma as decimal separator, without padding zeros; next to it the preselected unit g.

Further imask keys are passed through: blocks, definitions, lazy, placeholderChar, displayChar, eager, overwrite, skipInvalid, autofix, from, to, maxLength, enum.

scale affects only the display, but visibly so: with scale: 2 the mask cuts 12,34567 down to 12,34 as soon as it loads, and saving writes this shortened value back. For decimal, values are rounded beyond the fifth decimal place.

Formatting

The field type comes with two formattings, neither of them preselected anywhere:

FormattingOutputIdentifier
NumberThe number with the field’s maskstandard
Number with unitThe same, plus the uniteinheit

Since version 1.4.23 “Number” outputs only the mask. Before that, the only formatting was called “Number with unit”. Wherever it was chosen on a field with a unit, the unit has been missing since then until “Number with unit” is chosen. See Formatting .

When another field type fits

NeedField type
Whole numbersint
Several dimensions in one field, such as height, width and depth for object and frameJSON
Inventory numbers, shelf marksText
Classes such as under 50 and 50 to 100Virtual field on top of the number field