Data-expressions

A data-expression is an advanced functionality. Its purpose is to avoid having to recreate certain calculations across different clauses.

Example use case

Assume that a contract has a datafield #ordered-items^price, and another datafield #ordered-items^amount. It is not necessary — even to be avoided — to then also have a datafield to store the total price to be paid by the customer, because this price can be easily calculated on the basis of the two other fields. For example, assuming a VAT rate of 21%, the formula would be:

(#ordered-items^price * #ordered-items^amount) * 1.21.

It is, however, cumbersome to insert this calculation every time the total price needs to show up in a clause. Moreover, writing this calculation over and over again is error-prone, and difficult to manage if the calculation should be changed (e.g., if due to changes in negotiations some additional markup costs needs to be incorporated in the total price; if the VAT rate would change, etc).

Data-expressions allow you to centrally store calculations, and use them as if they were a simple datafield. In our example, the #ordered-items concept could thus be assigned a datafield total-price that would contain the calculation above. Each time the calculation is required, you can simply refer to #ordered-items^total-price.

Structure of data-expressions

A data-expression can be either a single expression, or a set of conditioned expressions.

Single expression

A data-expression with a single expression consists of any valid expression

Was this article helpful?
Dislike
Writing conditions
Rules of thumb for using datafields