Understand formula fieldThe formula field enables you to compute and generate a value based on a predefined formula. As its value is calculated, your users cannot enter an input for this field. When you add a formula field to your form, you are prompted to specify the expression, the resulting value from which is held by the formula field.
Understand setting the formula field's expressionThe formula field’s expression can include built-in functions, numeric operations, text operations, and logical operations based on static values and values stored in fields. The fields are referred by their field link names.
For example, you can set a formula field's expression as:
- 2 * 3 : This is a numeric operation that multiplies the numbers 2 and 3. As the inputs are numbers, the result "6" is also a number
- abcd + 1234 : As one value is a string and other a number, this becomes a text operation. The result will be the string "abcd1234" - a concatenation of the given values.
- input.Name + " - " + input.Email_address : This is a text operation. This expression refers other fields in the form, the field link names of which are Name and Email_address.
- If your formula field’s expression refers any fields in your form:
- Its value is calculated when the value in any of the participating fields is changed while adding or editing the record. This change could either be done manually by the user or via Deluge script placed in the OnLoad block of the form or OnUserInput of a field.
- If your users do not enter an input even in one of the participating fields, then the formula field does not display any result. It is instead set as null.
- If your formula field’s expression is based on static values, and does not refer any fields in your form, its value is calculated after your users submit your form, both - while adding or updating a record.
FeaturesYou can perform the following customizations for the user experience of the formula field on a form:
- Make the field visible in the form:
- As the value for the formula field is calculated and not entered by your users, it is, by default, not displayed when your users access your form. However, as a formula field’s value can be calculated based on the inputs your users enter in the other fields in your form, you can enable your users to view the calculated value.
- As the formula field’s value gets automatically updated whenever the value of fields (that are part of the formula) change, placing the formula field (on your form) near the referred fields may provide a better user-experience.
- Set expression:
- You can change the formula field’s expression whenever required. This provision is in place to let you accommodate with potential changes you may encounter while consuming your app over time.
- Changing the formula field’s expression will recalculate the value held by the formula field in all existing records in that form
- Customize the field name and field link name of this field
- Set the field size