Add and configure Mathematical Output Element in WPEForm

This outputs numbers using mathematical formula involving other form elements. This element can be used for any sort of calculations, like cost, days, significance etc.

IF YOU NEED TO STACK MULTIPLE MATHEMATICAL OUTPUTS, USE MATH GROUP FROM DESIGN ELEMENTS.

UNDERSTANDING THE FORMULA

From INTERFACE tab, see the Formula field. This is where you write down your math formula. You can refer to other elements by simply recalling them. Write down @ and it will show you a list of elements you can recall in the formula. If the given element has a Numeric Value (can be assessed from the element's documentation) then that value will be substituted.

Formula Screenshot
Formula Screenshot

Under the hood we use the great expr-eval library. So all functions and expressions are available. The following are some valid formulas.

[plain]
1(@toggle-elem == 1 ? @elem-one : @elem-two)

Copied!

If the value of the @toggle-elem is 1 (i.e, selected) then use the value of @elem-one, else use @elem-two.

[plain]
1abs(@date-elem-1 - @date-elem-2) / (60*60*24)

Copied!

The day difference between @date-elem-1 and @date-elem-2.

CHANGING BEHAVIOR

From the same INTERFACE page, you can change the following behaviors.

  • Type - How the output UI appears.
  • Decimal precision - Precision of decimal points.
  • Separator - Decimal and Thousands separators.
  • Prefix - HTML to put before the output.
  • Suffix - HTML to put after the output.