How to add a calculated field to a form
Calculated fields are used to calculate numeric entries on a form. By using calculated fields, manual calculations and errors are minimized. Results are displayed immediately, which helps users make informed decisions as a form is completed.
Any numeric field on a form can be used in a calculation including a time span field or other calculated field. Calculated fields can be used in advanced and basic forms, static and dynamic tables, sections, repeatable groups, and conditional fields. For more information about using calculated fields see, Useful Tips about Calculated Fields.
To add a calculated field to a form:
- In the Form Designer, from the Input menu, add Number inputs to the form for which you want to add a calculated field.
- From the Actions/Container menu, add a Calculated Field to the form.
- Click (Edit) to open the Edit Calculated Field window.
- On the Settings tab, mark Hidden if you don't want the calculated field to appear in the app. Mark Used for Personal Data if the calculation field is used for personal data. By checking this option, non-personal data is kept for analysis, while deleting the personal data.
- If adding a calculated field to a dynamic table and using a summary row, you can hide the calculation label by marking the Hide Calculation Label option. This is useful when a column is narrow, and the label might wrap. It's obvious the row is a sum of the column so you can leave the label off that row.
- Enter a label for the calculated field.
- In the Tooltip field, enter the tip/hint you may want to include for the calculated field.
-
The Replace Blank Field with 0 in Calculation option defaults marked. This option is used so that in complex calculations any number field in the calculation will use a zero in place of the blank to complete the transaction. For a simple calculation, you can decide whether using a zero makes a difference in the result and choose to use it or not.
- Enter the equation you want calculated on the form by selecting the field you want to use and adding any functions to structure your calculation.
-
Select Number or Duration as the display format. If you select Duration, specify the result and rounding options.
- Enter the number of decimal places the calculated amount will contain. The number of decimal places on the calculated answer does not need to match the number of decimal places on the numeric fields used to calculate the answer. On the mobile app, the decimals always show to this number even if they are zero.
- Enter a unit of measure that is displayed next to the number in the mobile app. Select whether you want the U of M text or symbol you type here to appear before or after the number. Units of measure are limited to 8 characters.
-
Calculated fields are number fields, so color formatting can be added.
To add formatting rules, click + (Add) under Formatting Rules. Select an Operator and the value. Click the palette to select a color. Then, select the tone of the color you want to use. The color boxes show the color of the field, and the color the text will be if you use that color. After you select the color, the palette button will change to the background and text color you selected for easy reference.
- Click the Styles tab to specify the style settings for the calculated field. See Using the Styles Tab for more information.
- Click the Validations tab to create a validation for the calculated field. See Creating Field Level Validations for more information.
- Click OK to save your entries. Click Cancel to close the Edit Calculated Field window without saving changes.
- You can check your calculations in the Preview window by entering numbers in the associated fields to be sure they’re correct. If the equation is in error, #ERROR! or #NAME? is displayed under the calculation.