Expression Field

An expression field is of the general form:
{
expression
Format
format case
Alt
alttext }
where both the
Format
(see Formatting) and the
Alt
parts are optional.

Alternative text

The
alttext
of an expression field is a double-quoted text.
It will appear in the generated document whenever the expression is non-evaluable. This situation occurs most often when one or more variables mentioned in the expression does not have a value. It can also occur when a function mentioned in the expression cannot be performed (e.g. the last member of an empty list).
For the expression field:
0 / 0 Alt "You cannot divide by zero!"
the generated document will contain:
You cannot divide by zero!

Simple variable expression

In its simplest form, an expression is merely the name of a variable:
{AddressSeller Format ", |, |"}
The generated document will contain the (formatted) value of the variable:
8-11 St John's St, London, EC1M 4BF

More complex expressions

Expression fields can be made up from many different parts.
For example, multiplication of two variables:
{CustomizationCost * SalesTax}
For example, multiple text concatenations:
{SellerSaluation + " " + SellerFirstName + " " + SellerSecondName}

Using functions in expressions

Expression fields can be made up using functions.
For example, use the MonthsAfter function to determine the termination date:
This Agreement terminates on {MonthsAfter( AgreementDate, TermLength )}
For example, summing a collection of repeated variables:
{Sum( Collect( CustomisationCost ) )}
For example, as above with a sales tax and formatted as a currency amount:
{Sum( Collect( CustomisationCost ) ) * SalesTax Format "currencydigits"}

Other expressions

For more on building expressions and other Contract Express features that can be included in expression fields, see the sections below: