CalculationElement: FormElementBase & {
    calculation: string;
    defaultValue: string;
    displayAsCurrency?: boolean;
    preCalculationDisplay?: string;
    type: "calculation";
}

Type declaration

  • calculation: string

    The calculation algorithm that must return a number. The following snytax is supported:

    • * equates to multiply
    • / equates to divide
    • + equates to add
    • - equates to minus
    • % equates to modulo
    • ( and ) parentheses can be used to dictate the order of operations
    • ROUND(n) will round "n" to the nearest whole number
    • ISNULL(n, x) will use the value of n if it is a number, otherwise the value of x will be used
    • {ELEMENT:elementName} will use the value from another element on the form. elementName must match the name property of an element on the form.
  • defaultValue: string

    This value should be valid HTML. It will be displayed to users when completing the form. The label property will not be displayed on the form. The result of the calculation is represented as {RESULT}. The HTML must include the result.

  • OptionaldisplayAsCurrency?: boolean

    If true, the {RESULT} in the defaultValue will be displayed as currency.

  • OptionalpreCalculationDisplay?: string

    This value should be valid HTML. It will be displayed to users when completing the form before until the calculation returns a valid number. Use this to give the user instructions on what is need to complete the calculation

  • type: "calculation"