Numeric input with unit

Numeric attributes typically combine a numeric value with a unit.

Input forms insert the following default combination of elements for this purpose:

images/download/attachments/34217051/image2019-4-11_15-59-9-version-1-modificationdate-1554991152000-api-v2.png

UNIT_NUMBER_INPUT

Input field for 'value'

left in screenshot

AUTO_COMPLETE_COMBO_BOX

Combo box with search function for 'unit'

right in screenshot

Both components can be removed from a form, for example if a numerical value should appear as a 'scalar' without a unit or the indication of a unit should be prevented for another reason.

The decision if a certain numeric attribute should be handled with or without a unit is rather fundamental, considering the capabilities and requirements for Unit conversion and Assigning numeric values with units.

If and how units should appear in forms, whether they can be changed and what the effects of changes should be can be fine-tuned specifically for each context.

Input field for numeric value (UNIT_NUMBER INPUT)

The input field for the numeric is related to the Text field and parametrized similarily.

Considerations for parameter choices:

  • Restrict input to either 'Integer only' or 'Numbers only'.

    • With other choices a default value 'NaN' (Not a Number) may appear, even if 'Text' is empty or contains a string convertible to numbers.

    • In HTML client the input field will only provide the integrated stepper (+/-) with these options.

    • Scientific notation (like '1.25e6' for 1250000) or hexadecimal input (like '0xFF' for 255) will not be supported.

  • Set 'max characters' to 0 (unrestricted) to ensure numeric values appear in full.

  • Settings for 'Number of digits' are only applied with the 'Numbers only' option, not with 'Integer only'.

  • Changed numerical values are saved as they are displayed, whereas unchanged values may keep higher precision.

Selection box for unit (AUTO_COMPLETE_COMBO_BOX)

For selecting a unit a Combobox is provided, defined by specific parameters in the Entries and service category.

images/download/attachments/34217051/image2019-4-11_16-1-5-version-1-modificationdate-1554991267000-api-v2.png

Settings for the Numeric Value Type of the numeric attribute define from which dynamic enumerations Units can be selected as Active entries for the selection field.

The option Convert value, is a specific setting for unit selection fields. It controls whether Unit Conversion updates the value when the unit is changed. If a conversion from the previous choice to the selected unit is not possible (see Unit conversion), the numeric value remains unchanged and is combined with the selected unit.

The Label expression can refer to the 'alias' of a unit (see screenshot above), which typically produces shorter label text than the default full text for the unit from localization appearing without a Label expression. The 'alias' is also used for values of the 'unit' attribute in XML-files:

Numerical Attribute (XML-snippet)
<value numericValueType="NORMAL_WIDTH" value="8.0" unit="ft"/>

►NOTE◄ The 'Alias' also appears attached to the numerical value, when a 'Number with unit' is assigned as value of a Text field by a calculation or the Set value action:

images/download/attachments/34217051/image2019-4-11_16-29-49-version-1-modificationdate-1554992991000-api-v2.png

  • In this example the text value for Container capacity is defined by assigning the value of Loading volume (converted) including the selected unit (Alias values feu/teu) reflecting standard container sizes (20 or 40 ft).

  • The unit comboboxes show the localized default texts (no Label expression). Still, the text field for Container capacity indicates the Alias-text (here: feu).