OpenGround contains a powerful expression engine that allows you to configure calculated Headers within the Model. The calculations are performed automatically and the resulting values are stored within your OpenGround database.
For general information on OpenGround expressions, please see our Expressions Guide.
This article and the links below provide information specific to working with expressions in Model Calculations and is intended to supplement the Expressions Guide.
It is possible to enter a Model Calculation Expression by going to System>Configuration Packs>Manage Model and editing the desired Group and Header (or adding a new Header).
For example, the DepthMidpoint Header in the SampleInformation Group is calculated below using this expression:
if(isnull(DepthBase), DepthTop, (DepthTop + DepthBase)/2)
Within a Project, calculated Headers are indicated by italics in both Professional and Portal.
When data is entered and committed to the database, calculations are automatically performed, and the calculated values appear in the grids.
Calculated Headers are read-only. Data also can not be imported directly into a calculated Header.
Calculations can be activated/de-activated by unchecking the Active option within Manage Model. The Expression will still be stored when de-activated, but the calculations will not be performed.
Entering or activating a Calculation Expression for a Header that already contains data will cause existing data to be overwritten when the calculations are processed.
In Model Calculations, Group/Header refences in expressions can use the syntax:
Header
For example (where FinalDepth is the Header being referenced):
fixed(FinalDepth,2,false)
Or alternatively, this syntax can be used:
[Group.Header]
For example:
fixed([LocationDetails.FinalDepth],2,false)
The [Group.Header] syntax is sometimes required when referencing foreign Groups, such as a child Group within an aggregate expression (see Aggregation below).
It is possible to have calculated Headers which reference other calculated Headers. The Model Calculation engine contains advanced logic to trigger dependent calculations to be reprocessed when data is updated.
Model Calculation expressions have a character limit of 3900 characters.
If you have a very long expression that exceeds this limit, it is recommended to break the calculation up into several nested Calculated Headers.
The following articles list functions that can be used within Model Calculation expressions:
Referencing child Groups within expressions requires the use of special “aggregate functions” to collate the set of multiple child values into a single value.
Please see our Aggregation in Model Calculations guide for more information.
When Model Calculation Expressions are added or edited, it will trigger calculations to reprocess throughout your database. You can also manually trigger calculations to reprocess. Please see this article for more information.