Adding Calculated Fields

With a calculated field, you can specify a formula for dynamically computing a value for a text, numeric, date, or values list field.

Before you begin

Complete the process for adding a date, numeric, text, cross-reference, or values list field.

Task 1: Make the field calculated

  1. From your application, go to Designer tab > Layout tab > Objects panel.
  2. Select the field.
  3. In the Properties panel > Options section, select Make this a calculated field.

Important: If you select Calculated Field and save this change for a field in which user-entered values have already been entered, all values written to that field are deleted across all records in the application and are replaced with calculated values. Conversely, if you clear the Calculated Field checkbox for a field in which calculated values have already been saved, those calculated values are retained in the database.

Task 2: Build the formula

You can edit a formula directly in the Formula field or the function and operations to insert the proper syntax.

  1. In the Calculation Properties section, click Edit to open the Formula Builder.
  2. Scroll down to Functions & Operators, select the functions and operators (1 at a time) that you want to use in the formula.
  3. Do 1 or more of the following:
    • To include a field reference as a parameter for the formula, click the field in the Available Fields list.
    • To include a field-value reference from a Values List field as a parameter for the formula, expand the appropriate field node in the Available Fields list and select the value. The value is added to your formula within the "VALUEOF" function.

      Note: If you select a field value to reference in your formula and that value is later modified in the values list, the field-value reference in your formula is automatically updated to reflect the modified value.

  4. When you finish creating the formula, click Validate in the top-right corner of the formula.

    If the validation process encounters an error in the formula, a message displays that describes the error or alerts you that the formula contains an unknown error. The validation process only identifies 1 error at a time, even if the formula contains multiple errors. If you get an error message, correct the error and click Validate again. If you get another error message, correct that error as well. Continue this process until the formula passes the validation process.

  5. Click Save.

Task 3: Define the recalculation behavior

  1. Go to the Calculation Properties section.
  2. In the Recalculation field, select behavior for recalculating field values.

    The following table describes the options.

    Field

    Description

    As Needed

    Formulas are recalculated when a dependent field in the formula changes.

    Always

    Formulas are recalculated every time content is saved even though a field is not referenced in the formula. Formulas that contain NOW() and TODAY() functions, or user first name, last name, and middle name (Editor) parameters are recalculated regardless of content change.

Task 4: Define the error handling behavior

  1. Go to the Calculation Properties section.
  2. In the Error Handling field, select rules for handling errors.

    The following table describes the options.

    Field

    Description

    Display Error

    Displays the word Error as a link when a calculation error occurs. Users with the appropriate access privileges can click the link to open the Calculation Error page where the error is explained.

    Use No Value

    Saves an empty value in the field when a calculation error occurs.

    Use Specific Value

    Saves a specific value in the field when a calculation error occurs

Task 5: Set configuration options

In the Configuration section, if the field is a Numeric field, set the following options:

The following table describes the options.

Option

Description

Decimal places

Specifies the number of decimal places required for values entered in the field (maximum 6). Entering a value in the numeric field with fewer decimal places than the required number pads the value with zeros.

For example, if you require 3 decimal places and you then enter a value of "4.1" in the field, the value displays as "4.100" when you save the record.

On the other hand, if you enter a value in the field with more decimal places than the required number, you must limit the number of decimal places in the value to fit the field requirements before you can save the record.

Negative display

Specifies how the negative numbers display. Options include:

  • (1234.56) font color = red; default option
  • -1234.56 font color = red
  • (1234.56) font color = black
  • -1234.56 font color = black

Prefix

Specifies the text (up to 10 characters) that appears in front of the numeric value. For example, when you enter "ABC" in this field, record displays "ABC123456."

Suffix

Specifies the text (up to 10 characters) that appears after the numeric value. For example, entering "miles" labels the field value as a measurement of distance. For the tracking ID, you enter "XYZ" in this field. The tracking ID value for a record displays "123456XYZ."

Task 6: Configure help text

Field-level help provides additional guidelines and instructions to ensure users enter appropriate information in the field. This Help text displays for users when they add, edit, and view records in the application where the field resides.

Consider the following general guidelines when writing field-level Help:

  • Use short, concise instructions that direct the user to take a specific action. For example, "Enter your name" is preferable to "This field is used to enter your name."
  • Use complete sentences whenever possible.
  • Avoid jargon (unless terms are critical and are familiar to your users).
  • Consider the technical aptitude of your audience, and author your help text at a corresponding level.
  • Use “you” and “your” as if you are speaking directly to the user.
  • Consider posing Help text in the form of a question, for example, "What is your level of interest?"

In the Help text section, do the following:

  1. Select a display option for both edit and view modes.
  2. The following table describes the options.
    Option

    Description

    None

    Help text does not display.

    Tooltip Icon

    Help icon displays beside the field in edit and view modes. Click this icon to display the field Help. The application dynamically sizes of the Help box based on the number of characters in the text.

    Field information on help icon hover

    Below

    Help displays below the field in edit and view modes.

    Field information below field

  3. If you are using help text, enter the text.

Task 7: Configure field access

Access rights determine whether all users or only select users or groups have access to the field.

In the Access section, do the following:

  1. Select Public or Private.
  2. Note: Key fields must be public.

  3. If you selected Private, maximize the pane and click Add to select the users and groups to whom you want to grant access.