Expressions

Expressions specify how to find or calculate a value when the print runs. They allow you to configure controls when you don't know in advance what the control's value will be.

For example, functions get their values at run time, so function calls are configured in expressions. Similarly, print inputs get their values at run time, so input parameters are referenced in expressions.

You can use expressions to build complex strings by concatenating string literals, functions, and input parameters. For example, you could use an expression to build a phrase with embedded inputs. To concatenate strings, you can use the + operator or the Concat() function. For example:

     'Printed by ' + [Parameters.Name]     is equivalent to     Concat('Printed by ',[Parameters.Name])

Some useful functions are listed below:

Configure Expressions

To configure an expression, you can either type in the expression or click the icon to use the Expression Editor. The Expression Editor provides a list of the available functions and input parameters to choose from.

The screen capture below shows an expression that uses the concatenate operator (+) to combine string literals with an input parameter and a function call.

Example of a Label control with an expression

Syntax

Follow the syntax conventions below when you create expressions:

Format String Expressions

To configure the font, color, padding, and border for a string expression, use the control's Appearance settings.

To format how dates, numbers, currency and other special values are presented, use one of the following methods:

Date-Time Functions

The table below lists some of the most useful date-time functions.

Function

Description

Example

LocalDateTimeNow()

Returns a date-time value corresponding to the current moment in time.

LocalDateTimeNow()

LocalDateTimeToday()

Returns a date-time value corresponding to today.

'Date: ' + LocalDateTimeToday()

Now()

Returns the current system date and time.

'Printed ' + Now()

Today()

Returns the current date. Regardless of the actual time, this function returns midnight of the current date.

Today()

UtcNow()

Returns the current system date and time, expressed as Coordinated Universal Time (UTC).

UtcNow()

 

See also...

Add Dates to Print Templates

String Functions

The table below lists some of the most useful string functions.

Function

Description

Example

Concat(String1, ... , StringN)

Returns a string value containing the concatenation of the current string with any additional strings.

Concat([Parameters.Notes],NewLine(),Now())

FormatString(Format, Value1, ... , ValueN)

Returns the specified string with formatted values. This function can accept any number of arguments. At run time, Value1, Value2, ... ValueN replace the placeholders {0}, {1}, ... {N}.

FormatString('Printed by {0} on {1:d MMMM yyyy}',[Parameters.Name],Today())

Lower(String)

Returns String in lowercase.

Lower([Parameters.Username])

NewLine()

Advances to a new line.

NewLine()

PadLeft(String, Length)

Left-aligns characters in the defined String, padding its left side with white space characters up to a specified total Length.

PadLeft([Parameters.Name], 30)

PadRight(String, Length)

Right-aligns characters in the defined String, padding its left side with white space characters up to a specified total Length.

PadRight([Parameters.Name], 10)

Trim(String)

Removes all leading and trailing space characters from String.

Trim([Parameters.Name])

Upper(String)

Returns String in uppercase.

Upper([Parameters.Title)

© 2019 Latitude Geographics Group Ltd. All Rights Reserved.

Documentation Version 5.0