Template Studio contains a powerful expression engine that can be used to perform calculations and manipulate data from your OpenGround database within your report templates.
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 Template Studio and is intended to supplement the Expressions Guide.
For many objects in Template Studio, it is possible to simply select a Group and Header from the database. This will pull in the value from the database and present it on your report. For example:
However, in many scenarios, you will want to manipulate the data in some way to present it on your report. In this case, expressions can be used. For example, the expression below is used to format the DateEnd from the LocationDetails group in ‘MM-dd-yyyy’ format:
text([LocationDetails.DateEnd], 'MM-dd-yyyy')
If both a Header is selected and an Expression is entered, the Expression will override the Header and be what gets presented on the final report.
Besides manipulating data that gets printed on your report, expressions are also used to control other behavior within Templates, such as:
In Templates, Group/Header references in expressions use the syntax:
[Group.Header]
For example, this expression references the FinalDepth Header in the LocationDetails Group using the fixed() function:
fixed([LocationDetails.FinalDepth],2,false)
Group and Header references are case-sensitive.
Group and Header references utilize ‘database names’ rather than ‘display names’.
In Template Studio, most objects will include dropdowns for the Group and Header. The database names are the names in parentheses:
Please see this article for more information on the functions that can be used within Template 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 Templates article for more information.
And please see our Aggregate Functions – Templates article listing functions that can be used to perform aggregation.
Please see the Text Formatting article within our Expression Guide, which is particularly relevant to Template expressions.
Template Studio contains an Expression Library where you can store commonly used expressions.