Expressions in Templates

Complete reference of built-in expressions in Templates of the TIVITY platform.

Expressions are used in various locations to recognize the places where which data from the TIVITY platform shall be inserted.

Work with Placeholders and External Documents

In a document expressions must be surrounded with “{ }”. So for example, an expression with the name “placeholder” must be defined as {placeholder}. The name for the expression must be named in the same way as the variable is named in the TIVITY platform. Therefore, see the Class Designer.

Next to the simple expressions, context depending expressions can be used. Therefore “Context.” must be added, as shown in the example.

Other additional parameters are:

  • Context.<Field-Key> {Context.FieldName}

    • Context: The actual object instance

    • <Field-Key>: A data field of the actual instance

  • Function.<Function-Key> {Function.GetRelation}

    • Function: A function

    • <Function-Key>: A function with its key

    • All parameters of the function are filled with variables from the context or with parameters defined in the template details respectively in the function itself.

  • Workflow.<Workflow-Key> {Workflow.GetRelation}

    • Workflow: A Workflow

    • <Workflow-Key>: A workflow with its key

    • All parameters of the workflow are filled with variables from the context or with parameters defined in the template details respectively in the workflow itself.

  • Template.<Template-Key> {Template.Signature}

    • Template: A template

    • <Template-Key>: A template with its key

Example of using context-specific expressions in a template

Template

Instance

Result

Fields of objects initialized in scripts

Fields of objects initialized in scripts can be accessed in 'External Document' templates via expressions:

{<VariableName>.<FieldName>}

VariableName must point to a variable with a value of type Object. FieldName must be the key or names of a field of the Object class.

Resolving happens right after resolving the script. The resolve is not successful if the variable is not found or not of type Object or no field with the key or name exists.

DateTime Formatting

For date values a build-in formatting is done based on the control types of a variable. This is done wherever you can specify control types and data types (for example template parameters, class fields).

As an example, let's take a class field with the name 'Done On' and with the Data Type DateTime. In the class designer we have the choice between the control types Calendar, TimePicker or DatePicker. Now, depending on the selection of the control type, a different formatting takes place. The following is entered in the template:

{Context.DoneOn}

Class field buld-in formatting:

Control type

Format

Calendar

DateTime (e.g. 2020/11/23 11:45:33)

TimePicker

Time (e.g. 11.45.33)

DatePicker

Date (e.g. 2020/11/23)

Template parameter build-in formatting (configured in template designer):

Control type

Format

Date + Time

DateTime (e.g. 2020/11/23 11:45:33)

Time

Time (e.g. 11:45:33)

Date

Date (e.g. 2020/11/23)

Custom Formatting

Custom formatting expression formats are separated with ':'. Everything on the left is to identify the value (e.g. context fields or script variables). Everything on the right is the format to use. NULL values for expressions with formats ignore formatting (an empty text is displayed). Formats for unknown formats can cause errors. The error includes the identifier and the format.

Syntax

{DateTimePlaceholder:yyyy-mm-dd}

Context specific expressions

{Context.IntegerField:c}
{Function.NameOfFunc:yyyy-MM}
{Workflow.NameOfWorkflow:d}

The following data types are supported:

Xml escape

Expression format 'xmlescape' replaces invalid XML characters with their valid XML equivalent: '\"&<> to &apos;&quote;&amp;&lt;&gt;

Syntax

{StringPlaceholder:xmlescape}

List of built-in Expressions

{DateTime.Now}

Returns the current date and time.

Syntax

{DateTime.Now}

{DateTime.Now.Date}

Returns the current date.

Syntax

{DateTime.Now.Date}

{DateTime.Now.Add(<Parameters>)}

Returns the time calculated based on the current time (the span to be added is passed as a parameter(s)). You can add either years or days or hours or minutes. If the value is negative the resulting time will be in the past.

Syntax

{DateTime.Now.Add(YEARS, 1)}
{DateTime.Now.Add(DAYS, -7)}
{DateTime.Now.Add(HOURS, 12)}

Parameters

  • YEARS,<years> or

  • DAYS,<days> or

  • HOURS,<hours> or

  • MINUTES,<minutes>

{NewGuid()}

Returns a new generated value of the universally unique identifier.

Syntax

{NewGuid()}

{CurrentUser.<Property>}

Returns the specified property of the current user.

The value of a DefaultTemplate, an Expression or a Condition Value can be a mix of a text and one or more expressions enclosed in the curly brackets. The resulting value is concatenated after evaluation of the expressions. For example if the expression for the virtual field FullName is "{FirstName} {LastName}", the FirstName="John" and the LastName="Brown", the value of the field FullName is "John Brown".

Syntax

{CurrentUser.Id}
{CurrentUser.FirstName}
{CurrentUser.Nickname}

Properties

Possible properties:

  • Id

  • LanguageId

  • LoginName

  • FirstName

  • LastName

  • Nickname

{CurrentOffice.Id}

Returns the id of the current workspace.

Syntax

{CurrentOffice.Id}

{CurrentApplication.Id}

Returns the id of the current application.

Syntax

{CurrentApplication.Id}

{ParentObject.<Property>}

Returns the specified field of the parent object (relevant if the object is created as a link of some other object - its parent).

Syntax

{ParentObject.\<Property\>}

{LinkPath["<ClassName>"].<FieldName>}

Returns the value of the specified field of the parent object with the specified class name (relevant for indirectly linked objects).

Syntax

{LinkPath["<ClassName>"].<FieldName>}

{UserSortValue(<Parameters>)}

Returns the next order number. Used with properties with the internal key "UserSort" in order to define whether the new object will be placed on top of the list (parameter = MinValue) or on bottom (parameter = MaxValue).

Syntax

{UserSortValue(MaxValue)}

Parameters

  • MaxValue or

  • MinValue

{LastInput()}

Returns the same value which the current user set the last time. The properties with the internal keys CreatedOn and CreatedBy must be defined for the class in order this expression takes effect.

Syntax

{LastInput()}

Last updated

Was this helpful?