Calculation fundamentals
Calculations are defined by using the task. After you publish a calculation, it is available in OpenPages®.
Show me how
For a demonstration of how to use calculations, see the following video. It explains the fields in a calculation definition and how to construct a list of operations.
Calculation definitions
A calculation definition is defined for one object type. An object type can have multiple calculations.
A calculation definition has the following characteristics:
- A calculation definition is static.
- A calculation definition is versioned.
Each time a calculation definition is published, a new version of that calculation definition is made available to users. The new version is used for object changes that are made after it is published. It does not affect calculations that have already been run.
- A calculation definition can be disabled.
When a calculation definition is disabled, no new calculation can be run. Disabled calculation definitions can be re-enabled.
A calculation definition is made up of the following elements:
- Calculation properties
Calculation properties define basic information, for example, the object type that the calculation applies to and whether the calculation is enabled.
- Applicability conditions
Applicability conditions restrict the calculation to objects that meet specific criteria.
- Operations
Operations determine what the calculation does.
Goal of a calculation
The goal of a calculation is to set a value for one or more fields on an object, based on the values of one or more other fields. Only fields on the object type for the calculation can be set. Fields on related object types cannot be set.
Operations determine what a calculation does
A calculation is made up of multiple operations. A calculation can have three types of operations:
- Input field operation
Retrieves an input field that is used in a later operation. An input field operation can be from the current object, a related object, or the Preference object. Conditions can be defined on the input field. A calculation can have multiple input field operations.
- Variable operation
Contains an intermediary value that is used in a later operation. A variable operation contains an expression that can use all previously defined operations, be they input fields, other variables, or set field operations. A calculation can have multiple variable operations.
- Set field operation
Sets a field value on an object. A set field operation contains an expression that can use all previously defined operations, be they input fields, variables, or other set field operations. A calculation can have multiple set field operations.
Operations are defined for a single calculation. They cannot be shared among multiple calculations.
What does the calculation type do?
The calculation type determines whether a calculation can be started by a workflow. There are two calculation types:
- Manual calculations are started only by a run a calculation action in a workflow.
- Automatic calculations are started in all other ways except by a run a calculation action in a workflow.
In Task Views, fields that contain the result of an automatic calculation are read only and cannot be changed by the users. However, fields that contain the result of a manual calculation are not read only and the values can be changed by users.
When do calculations run?
A calculation runs when an enabled, published calculation exists for an object type. An object must meet both a calculation's applicability and conditions on the value of the input field, if defined.
Manual calculations run when a run a calculation action in a workflow starts.
input fieldmeans any field that provides input to the calculation, including (but not limited to) fields that are defined in input field operations.
- A user updates a calculation's input field on an object in a Task View.
- On a related object in a Task View, a user updates a calculation's input field. If a user updates a field on, for example, a child object, a calculation on a parent object type is run.
- A user associates an existing related object to another object, where either or both objects contain a field that is used in a calculation.
- A user starts a workflow that creates an object for an object type that has a calculation.
- A user completes a stage in a workflow that updates a calculation's input field.
- A user completes a stage in a workflow that updates a calculation's input field on a related object.
- A user completes a stage in a workflow that associates an existing related object to another object, where either object contains an input field that is used in a calculation.
- An administrator runs a calculation by clicking , selecting a single
calculation, and clicking
. - An administrator uploads data with FastMap. The data contains new objects or changes to a calculation's input fields.
- Data is loaded by using an API, where the data contains new objects, changes to a calculation's input fields (on the object or related objects), or changes to object associations.
When a user updates an input field on an object in a Task View, all calculations for that object type that use the changed input fields are run. The order in which the calculations run cannot be defined.
New calculations and existing objects
When you create a new calculation, it does not automatically run on existing objects. A calculation is run when actions described in When do calculations run? take place.
Object types and calculations
An object type can have multiple calculations. But each calculation must set different fields. No two calculations can set the same field. A calculation runs for all objects that qualify for it, given the applicability and input field conditions.
Debugging calculations
For information about correcting calculations that have errors, see Testing and debugging a calculation.
Sample calculations
OpenPages includes sample calculations. For more information, see Sample calculations.
Comparison of calculations and triggers
The GRC Calculations feature, together with the GRC Workflow feature, provide a powerful platform that allows organizations to tailor the system to their specific requirements. Existing OpenPages customers that use triggers can make a plan to transition from triggers to GRC Calculations and GRC Workflow.
Calculations can replace the following functionality that was previously available in triggers:
- Automation for data input
- Mathematical operations
- Assessment rating assignments
- Data aggregation
- Helper links
Calculations and workflows that are defined by using GRC Calculations and GRC Workflow are easier to define and maintain than triggers. Triggers require a high level of technical expertise, whereas most calculations and workflows can be defined by business specialists. For complicated calculations and workflows, technical expertise is an advantage.
Triggers that currently work in your environment, continue to work. But your organization should make a plan to transition existing triggers to calculations.
Functionality that is available in triggers is also available in GRC Calculations and GRC Workflow.