Free cookie consent management tool by TermsFeed

Decimal Component

On This Page

Displays and accepts a single decimal value. Supports both Number (Decimal Floating) and Number (Decimal Precise) data types.

Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to closeA decimal component displaying a Unit Price field with instructional text

When working with an integer, use an integer component. To display a number using a custom format, use a text component.

Parameters

a!decimalField( label, instructions, required, readOnly, disabled, value, decimalType, validations, saveInto, validationGroup, requiredMessage, align, labelPosition, refreshAfter, placeholder, helpTooltip, accessibilityText, showWhen, marginAbove, marginBelow )

Name Keyword Types Description

Label

label

Text

Text to display as the field label.

Instructions

instructions

Text

Supplemental text about this field.

Required

required

Boolean

Determines if a value is required to submit the form. Default: false.

Read-only

readOnly

Boolean

Determines if the field should display as not editable. Default: false.

Disabled

disabled

Boolean

Determines if the field should display as potentially editable but grayed out. Default: false.

Display Value

value

Number (Decimal Precise), Number (Decimal Floating)

Number to display in the field.

Decimal Type

decimalType

Text

Determines the precision of the decimal value. Set to "PRECISE" to store values with arbitrary precision, or "FLOATING" for standard floating-point precision. Valid values: "PRECISE" (default), "FLOATING".

Validations

validations

List of Text String

Validation errors to display below the field when the value is not null.

Save Input To

saveInto

List of Save

One or more variables that are updated with the number when the user changes it. Use a!save() to save a modified or alternative value to a variable.

Validation Group

validationGroup

Text

When present, the requiredness of the field is only evaluated when a button in the same validation group is pressed. The value for this parameter cannot contain spaces. For example, "validation group" is not a valid value. You need to add an underscore between words: "validation_group". See the following recipes for more information:

Required Message

requiredMessage

Text

Custom message to display when the field's value is required and not provided.

Alignment

align

Text

Determines alignment of the number value. Appian recommends this setting only be used inside an editable grid component. Valid values: "LEFT", "CENTER", "RIGHT".

Label Position

labelPosition

Text

Determines where the label appears. Valid values:

  • "ABOVE" (default) Displays the label above the component.
  • "ADJACENT" Displays the label to the left of the component.
  • "COLLAPSED" Hides the label. The label will still be read by screen readers; see accessibility considerations for more information.
  • "JUSTIFIED" Aligns the label alongside the component starting at the edge of the page.

Refresh After

refreshAfter

Text

Determines when the saveInto expression is evaluated. Valid values: "UNFOCUS" (default), "KEYPRESS". When set to "UNFOCUS", the expression evaluates when the user deselects the field after changing its value. When set to "KEYPRESS", the expression evaluates after every character typed into the field.

Placeholder

placeholder

Text

Text to display in the field when it is empty. Does not show if the field is read only.

Help Tooltip

helpTooltip

Text

Displays a help icon with the specified text as a tooltip. The tooltip displays a maximum of 500 characters. The help icon does not show when the label position is "COLLAPSED".

Accessibility Text

accessibilityText

Text

Additional text to be announced by screen readers. Used only for accessibility; produces no visible change.

Show When

showWhen

Boolean

Determines whether the component is displayed on the interface. When set to false, the component is hidden and is not evaluated. Default: true.

Margin Above

marginAbove

Text

Determines how much space is added above the component. Valid values: "NONE" (default), "EVEN_LESS", "LESS", "STANDARD", "MORE", "EVEN_MORE".

Margin Below

marginBelow

Text

Determines how much space is added below the component. Valid values: "NONE", "EVEN_LESS", "LESS", "STANDARD" (default), "MORE", "EVEN_MORE".

Using the decimal component

The following sections cover important details about the decimal component.

Using the decimalType parameter

The decimalType parameter determines which decimal data type the decimal component uses to store the value:

  • "PRECISE": Stores the value as a Number (Decimal Precise) value. This is the default.
  • "FLOATING": Stores the value as a Number (Decimal Floating) value.

Set the decimalType parameter to match the data type of the variable or record field that you save the value into. Saving a value into a field of a different decimal type converts the value and can change its precision. See Casting for the conversion rules.

Display precision

When decimalType is "PRECISE", the decimal component displays the entire precision of the value. Other components that display a Number (Decimal Precise) value truncate it to 15 significant decimal digits.

Using text and placeholder text

If you want to display a number with thousand separators or with special formatting such as a currency, use the text component instead.

Whether placeholder text clears on focus or input varies by device and browser.

Examples

The following examples references a rule input (ri!item) that uses the Order Item record type as the type. These examples will error if you try to use them in yours. Use the examples as a reference only.

Collect a precise decimal value

1
2
3
4
5
6
a!decimalField(
  label: "Unit Price",
  value: ri!item[recordType!Order Item.fields.unitPrice],
  saveInto: ri!item[recordType!Order Item.fields.unitPrice],
  decimalType: "PRECISE"
)

Collect a floating point decimal value

1
2
3
4
5
6
a!decimalField(
  label: "Item Weight",
  value: ri!item[recordType!Order Item.fields.weight],
  saveInto: ri!item[recordType!Order Item.fields.weight],
  decimalType: "FLOATING"
)

Validate a decimal value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
a!decimalField(
  label: "Unit Price",
  value: ri!item[recordType!Order Item.fields.unitPrice],
  saveInto: ri!item[recordType!Order Item.fields.unitPrice],
  decimalType: "PRECISE",
  validations: if(
    or(
      ri!item[recordType!Order Item.fields.unitPrice] <= 0.0,
      ri!item[recordType!Order Item.fields.unitPrice] > 9999.99
    ),
    "Enter a price between $0.01 and $9,999.99.",
    ""
  )
)

Display a read-only decimal with a label

1
2
3
4
5
6
7
8
a!decimalField(
  label: "Unit Price",
  readOnly: true,
  value: a!defaultValue(
    value: ri!item[recordType!Order Item.fields.unitPrice],
    default: "-"
  )
)

Feature compatibility

The table below lists this component's compatibility with various features in Appian.
Feature Compatibility Note
Portals Incompatible
Offline Interfaces Incompatible
Sync-Time Custom Record Fields Incompatible
Real-Time Custom Record Fields Incompatible

Custom record fields that evaluate in real time must be configured using one or more Custom Field functions.

Process Reports Incompatible

Cannot be used to configure a process report.

Process Events Incompatible

Cannot be used to configure a process event node, such as a start event or timer event.

Process Autoscaling Incompatible

Cannot be used in autoscaled processes.

Event Consumer Filter Conditions Compatible

Can be used in filter conditions.

Event Consumer Event Handlers Compatible

Can be used in event handler expressions.

Feedback