Calculation Process

Formulas of calculated fields are recalculated whenever there is a change in the content of a field, related field, or sub-form. Calculations are run either through administrative or user functions.

Administrative and user functions

The following table describes the administrative and user functions.

Function

Action

Result

Administrative

Calculations queued in an asynchronous job

Administrator updates a formula of a calculated field and queues an asynchronous job. This job runs during normal processing based on the number of jobs in the queue.

 

Calculations scheduled in an asynchronous job

  1. Administrator schedules an asynchronous job to run a full module recalculation from the Calculations tab of the module in the Application Builder. This job is queued with all fields in the module for calculation.
  2. Administrator creates a Schedule to run an asynchronous job for recalculation at a specific time. Only the fields that contain NOW() or TODAY() functions in their formulas are recalculated. If the record contains such fields, and any of them recalculate to a different value, then any fields set to Always Recalculate in the record will also be recalculated.

User

Calculations recalculated inline

  1. User clicks the Recalculate button while viewing a record. Content ‘marked’ for recalculation is recalculated.
  2. User clicks the Apply button without making a change. Content ‘marked’ for recalculation is recalculated.
  3. User clicks the Save button after making a change. Content is saved and ‘marked’ content is recalculated.

Recalculation process

The following table describes how recalculations are processed. Recalculations are processed immediately or through an asynchronous job.

Type

Description

Immediate

Calculations are triggered by a user saving a record that is either 'marked' or changing a field that is used by a calculated field in the same level. 'Marked' content is changed to an ‘unmarked’ status when a user saves that content.

An immediately applied calculation can be performed in a cross-referenced application 1 level away.

For example, Application A is dependent on a calculated field in Application B. Application B has a cross-reference relationship with Application A. When a record is updated in Application B, its related record in Application A can be recalculated immediately when the user returns to Application A and clicks Apply or Save.

Related records are updated when a user initiates the recalculation or the recalculation is updated through an asynchronous job.

  • When updated by the user, the Last Updated field contains the identification of the user who updated the record.
  • When updated by an asynchronous job, the Last Updated field is not updated. 

Asynchronous jobs

Queued asynchronous jobs run based on the number of jobs in the job queue. Scheduled asynchronous jobs run at a specified time regardless of any current activity on the record.

Calculations are queued in an asynchronous job in various ways.

  • Change the formula of a calculated field, and select Yes to recalculate the field.
  • Change the weight of a question field.
  • Change the order of calculations.
  • Change the Recalculation option of a calculated field, and select Yes to recalculate the field.
  • Change the Error Handling option of a calculated field, and select Yes to recalculate the field.
  • Change the input mask on a text field that is referenced by a calculated field.
  • Change the numeric attribute of a value in a Values List field that is referenced by a calculated field.
  • Change the Other text attribute of a value in a Values List field that is referenced by a calculated field.
  • Change the Correctness attribute of a value in a Questions Values List field that is referenced by a calculated field.

Example: Triggers for recalculating

The following table describes example scenarios of triggers for recalculating.

Scenario 1

  1. Edit a record by changing a field that is tied to a calculated field in an application.
  2. Save the record.

Results: Any calculated field dependent on that change is recalculated immediately.

Scenario 2

  1. Edit a record that has a dependent field in a related application.
  2. Drill into a cross-reference application.
  3. Change the dependent field in a related record.
  4. Save the record.

Results: Recalculations for the dependent fields are queued in an asynchronous job and is processed based on the number of jobs in the job queue.

Asynchronous job processing

When you change the formula of a calculated field and schedules the recalculation in an asynchronous job, the content affected by this change has a status of ‘marked’ for recalculation.

When this condition exists, the following occurs:

  • The asynchronous job is queued with all fields ‘marked’ for recalculation.
  • The content is ‘marked’ for recalculation and can be recalculated immediately in View or Edit mode.
  • Any calculated field in the same level with the content status of ‘marked’ is reset and is no longer ‘marked’ for recalculation.

When you change the formula of a calculated field but does not schedule the recalculation in an asynchronous job, the contents in this application affected by this change is not ‘marked’. When this condition exists, the content status is updated by a user saving the change or by the asynchronous job.

However, if you change 1 or more fields and only schedule an asynchronous job for 1 of the fields, all fields ‘marked’ for recalculation are included in the asynchronous job.

Example: Asynchronous Job Queued

The following table describes an example scenario of an Asynchronous Job Queued.

Scenario

There are 4 fields: Risk, Criticality, Controls, and Rating.

Risk is dependent on the value of Criticality.

SUM([Risk], [Criticality]).

Field Controls is dependent on the value of Rating.

IF(CONTAINS[Rating] “10”, RANK(REF([Controls] “5”)))

Action 1

Administrator updates both formulas of the calculated fields and schedules an asynchronous job to recalculate the fields.

Results

Formulas are updated in the applications.

[Risk] and [Controls] are ‘marked’ for recalculation.

Action 2

User with Read and Update permissions views the record in View mode.

User notices message that content is not up to date and clicks Recalculate.

Results

[Risk] is recalculated immediately, and the updated value is displayed.

[Controls] is recalculated immediately, and the updated value is displayed.

Example: Asynchronous Job Not Queued

The following table describes an example of an Asynchronous Job Not Queued.

Scenario

There are 4 fields: Risk, Criticality, Controls, and Rating. Risk is dependent on the value of Criticality. SUM([Risk], [Criticality]). Field Controls is dependent on the value of Rating. IF(CONTAINS[Rating] “10”, RANK(REF([Controls] “5”)))

Action 1

Administrator updates both formulas of the calculated fields and does not schedule an asynchronous job to recalculate the fields.

Results

Formulas are updated in the applications. [Risk] and [Controls] are not ‘marked’ for recalculation.

Action 2

User with Read and Update permissions views the record in View mode. User is not notified that content is not up to date.

Results

Contents of [Risk] and [Controls] are not updated.