In versions of Dexterity prior to 5.5, calculated fields were evaluated in the order they were created. This mean that a calculated field could refer to only the calculated fields that were created before it. This restriction has been removed. As long as there aren’t any dependencies that prevent it, a calculated field can refer to any other calculated field.
The order in which calculated fields are evaluated is important when dependencies exist between them. For example, if calculated field B refers to calculated field A, A must be evaluated before B can be. A dependency exists between these two calculated fields.
Dexterity can recognize dependencies among calculated fields, and evaluates them in the appropriate order to ensure they have correct values. Dexterity won’t allow you to create invalid situations such as circular dependencies. The following example is one situation that creates a circular dependency: calculated field A refers to calculated field B, which refers back to calculated field A.
If you use user-defined functions in your calculated fields, you can create dependencies that Dexterity can’t recognize. These “hidden” dependencies occur in the following cases:
In both of these cases, the order in which the calculated fields are evaluated is crucial. If they are evaluated in the incorrect order, the report will produce incorrect results.
You can use the Evaluate After field in the Calculated Field Definition window to specify when a calculated field will be evaluated. The calculated field being defined will be evaluated after the calculated field you select in the Evaluate After drop-down list. This drop-down list will contain the names of the other calculated fields in the report. Some calculated fields won’t appear in this list if known dependencies exclude them as valid choices. When you specify a field with the Evaluate After drop-down list, you are creating a dependency between the two calculated fields.
The Evaluate After drop-down list also contains the choice <any>. This is the default for a new calculated field. Choose <any> when the order in which the calculated field is evaluated isn’t significant. Choosing <any> also makes the calculated field available for use in as many other calculated fields as possible.
In virtually all cases, you will leave the Evaluate After field set to <any>. If calculated fields for a report have hidden dependencies, use the Evaluate After field to ensure the calculated fields are evaluated in the proper order.
In versions of Dexterity prior to 5.5, calculated fields were evaluated in resource ID order. To ensure backward compatibility, the calculated fields for existing reports created with these earlier versions have the Evaluate After drop-down list set to duplicate the resource ID evaluation order.
We recommend that you set the Evaluate After field for all calculated fields to <any> for each of your reports. Then identify any hidden dependencies among the calculated fields. If any hidden dependencies exist, use the Evaluate After field to ensure the fields involved in the dependency are evaluated in the proper order. You can use the Evaluate After utility, found in Dexterity Utilities, to help you update existing reports.