Form element: Formula
The formula field allows you to use simple or compound formulas to create calculations in forms. Formula fields auto-calculate when a user enters data (like a quantity or price) in fields referenced by a formula.
Formula fields can be used in forms created for purchase requests, quotes, expense reports, swag orders, and more.
Formula reference fields
Any form fields whose values you want to use in a formula need to be added to the form before you can add a formula. Formulas can reference values from numeric, currency, or other formula fields in the form.
Give your reference fields unique titles to make them easy to identify when adding fields to a formula. eg. Total A, Total B, and Total C can be differentiated, rather than three fields all titled Total.
Add a formula field
- Go into Edit mode on the Form that you want to add the Formula field to.
- Add any numeric, currency or formula fields that you want to use in your formula.
- Click on the Formula element under Select elements on the left and drag and drop the Formula element where you want it to appear in the form.
- Click on the Formula element title or field to edit Formula options.
- In the Formula pop-up window, add Formula element details.
- Field name: Enter a title to display above the formula field.
- Help text: Enter a brief description or explanation to help users understand the field.
- Formula: Enter a formula using field names and operators. Type [ to see a dropdown list of available numeric, currency or formula fields in the form that you can reference in your formula.
- Prefix: Enter text to display before the formula result. Eg. $, ¥, €
- Suffix: Enter text to display after the formula result. Eg. CAD, %, l, oz.
- Decimal places: Click on the dropdown and select how many decimal places to display, from 0 to 3.
- Number display: Click on the dropdown and select the number format to use.
- If your intranet has multiple languages, select another language in the language dropdown in the bottom left. Add a Field name for the language you have selected. Repeat for multiple languages.
- Click Save.
Example
In the image above, formula fields are being used to calculate the Subtotal, Tax and Total values based on the Quantity entered by the user. Column totals are also displayed at the bottom of each column (optional).
The image below shows the Formula field setup for the Subtotal column shown above.
Add Formula field to a table
When you add a Formula field to a column in a table, every row added to the table will apply the same formula to that column.
When you add a Formula field to a table, there is one additional Formula element option in the Formula pop-up window.
- Total: Select the checkbox Show total if you want the column values to be added together and the total displayed at the bottom of the column.
To learn more about tables in forms, see Insert a table into a Form.
Comments
0 comments
Please sign in to leave a comment.