GRC Calculations FAQs

The following list provides answers to frequently asked questions about calculations.
Can one calculation set values for multiple fields?
Yes. A single calculation can set the values for multiple fields. They must be fields on the object type that the calculation is defined for.
Can multiple calculations set a value for the same field?
Yes. A field can be used as a set value operation in multiple calculations. However, the order in which calculations run is not guaranteed. Therefore, plan your calculations to avoid collisions and overwrites.
Can a calculation set a value for the same set value field multiple times within that calculation?
Yes. A value can be set multiple times for the same field within a calculation (this means that multiple set field operations for the same field are allowed).
Are there fields that a calculation is not allowed to set?
Yes. A calculation is not allowed to set the values for computed fields, workflow system fields, and many of the system fields like System Fields:Creation Date. Additionally, calculations cannot set fields that are defined as relationship fields in Task Views.
Can a calculation set user and date system fields?
No. While a calculation can use the user and date system fields as input fields, a calculation cannot set the value of the following system fields:
  • System Fields:Created By
  • System Fields:Last Modified By
  • System Fields.Last Modification Date
  • System Fields.Creation Date
  • System Fields:Name

If you create your own user field and want to set it to the value in, for example, System Fields:Last Modified By, be sure to define the user field with field type defined as simple string and display type as user selector.

Can a calculation set a field that is defined as read-only in a Task View?
Yes.
Do calculations honor field dependency rules?
No. For example, if a user updates the value of an input field on a Task View and a calculation runs, the object can be saved even if the output field value does not meet the field dependency rules.
What happens if a calculation updates a controlling field?
Use caution when defining calculations that set values for fields that are controlling fields. In some situations, changes can be lost in Task Views because a loop is created. For example, say that Field B is a controlling field and Field A is a dependent field (is set to Read-only or Editable based on Field B). If a calculation updates Field B based on a change to Field A, the update to Field A might be lost in the Task view. The dependency is enforced without saving the updated value.

To avoid this, use separate Task Views, one that runs a calculation and one that sets dependent fields.

Do calculations honor dependent pick list rules if a calculation is based on the controlling field ?
Yes. If a calculation sets a value for a field that is a controlling field in a dependent pick list, it also sets values for dependent fields to allowed values.
Can a calculation set a field on a related object or Preference object?
No. A calculation can set a field only on objects of the object type that the calculation is defined for.
Can a calculation be based on a field on a related object or Preference object?
Yes. A calculation can use fields on a related object or Preference object as input fields.
How do I use Preference objects in calculations?
Preference objects specify variable values that are specific for a business entity. You can use the field values of Preference objects in calculations.
  • Calculations do not use Preference Group objects. They use only Preference objects.
  • The Preference object that is used is the one that is associated with the Primary Business Entity parent (or ancestor) that is closest to the object where the calculation is occurring.
  • The Preference objects of non-primary business entities are not used in calculations.
  • When a primary parent business entity has multiple Preference objects, you can use all of the Preference objects that are associated with the primary parent business entity. Design your calculations to handle multiple Preference objects. For example, your calculation might use a specific Preference object based on the value of a field.
    Note: Some of the sample calculations that are provided with OpenPages® are not designed to manage multiple Preference objects for business entities. When you run one of these sample calculations, you might get an error such as Invalid field assignment.
  • If you change the field values of a Preference object or if you change the relationship of a preference object, the calculations might not run automatically.

    For example, if you update a field value in a Preference object, add a Preference object, or change the primary parent of a Preference object, the calculations that use the Preference object might not run automatically. In this case, re-run the calculation. See Running a calculation as an administrator.

Can one calculation be linked to another calculation?
No, each calculation is independent. But the result of one calculation can cascade to other calculations. For more information, see Designing a calculation.
Can I include a filter within a calculation?
Yes, a filter (condition) can be applied to input fields that are defined for related objects and Preference objects.
Can a calculation get invoked from a workflow?
Yes, if the workflow starts an action that causes a calculation to run. This might include creating an object, updating an input field on an object, updating an input field on a related object, and associating objects.
Can I access siblings on a calculation?
No. Fields from siblings of the open object cannot be used as input fields.
Can I access child, parent, ascendent, and descendant objects?
Yes, input fields can be fields from child, parent, ascendent, or descendant objects.
Can a calculation invoke an association or copy operation?
No. A calculation can only set field values.
Can a calculation access the values in registry settings?
Yes
Are there sample calculations?
Yes. See the IBM OpenPages Solutions Guide.
Can I access a specific value in a multi-value field?
Yes. Use an index on the field, for example, at([$Causal Category$],2), to access the enumerated value in the third position of the Causal Category field. It accesses the third position because counting begins at zero.
Can I edit the text in the body of the email that is sent to the administrator after they run a calculation?
Yes. The body text is defined in application text.
Is there an undo for a calculation?
No.
Can calculations be included in the scheduler?
No.
Can calculations be started by a workflow action?
Yes. Manual calculations can be started by a run a calculation operation on a workflow action. For more information, see Defining a workflow action that runs a calculation.
Can I schedule a calculation to run in off hours?
No. However, you can disable calculations all together or disable individual calculations to control when calculations run. For example, you can disable calculations before a Fast map load. Then, run the calculations after the data is loaded. You can also disable calculations during working hours. Enable the calculations, run them in off hours, and disable them again during working hours.
Must the input fields and set fields be included in a Task View for a calculation to run?
No. Calculations are run when an input field is changed, regardless of whether it is shown in a Task View or not. If the input field is required, it must be in the creation view.
When I use a Task View, what causes a calculation to run?
A calculation runs either when an object is saved or only when an input field that is used in a calculation is changed. The Always Recalculate on the Object Save registry setting controls the behavior.
Why are set fields updated BEFORE I click Save in a Task View?
When you change an input field and move the focus outside the field, all the calculations that use that input field are run in preview mode. The new values for set fields are calculated and displayed if they are included in the Task View. The values that are shown in preview mode are saved to the database when you click Save.
Do I need to click Save for the calculation to run?
No. Calculations run in preview mode when you move the focus outside an input field whose value you changed. But you must click Save for the results of the calculation to be saved in the database.
Can I manually update the value in a set field in a Task View, thereby overriding the calculated value?
It depends on the calculation type. Set fields that are calculated by automatic calculations are read only in a Task View. If the calculation is disabled, the set field becomes editable or however the field is defined to display in the Task View. Set fields that are calculated by manual calculations are not read only in a Task View and are editable.
What can I do to optimize speed and performance?
Keep the expressions as simple and short as possible. A calculation with many operations with complex expressions might impact performance.