Using Expressions within Reports

What is an Expression?

An expression is a string that, when parsed and processed, evaluates some value. Expressions consist of column/field names, constants, operators, and functions. Column/field names must be wrapped with brackets.

Why Use Expressions?

While OnTime offers hundreds of different fields to choose from, there may be times when a very specific field is needed. In such cases, expressions can be used to create the needed field. For example, the following expression combines the first and last name of a user, separated by a space, to display the user's full name:
[User.FirstName] + ' ' + [User.LastName]

Expression Editor

The Expression Editor supports a variety of math, date-time, string, and logical functions. To learn more about the supported functions, refer to Using Expression Operators, Functions, Constants, and Criteria in the Report Expression Editor. The following syntax conventions should be taken into account when using the Expression Editor:
  • A data field is referenced by enclosing its name in square brackets. Example: [Weight] or [Price Modifiers].[Name]
  • String values are denoted with apostrophes. An attempt to use quotes instead will result in an error. To embed an apostrophe into an expression's text, type a double apostrophe. Example: 'It''s sample text'
  • Date-time constants should be enclosed with hashtags. Example:  [Date Submitted]  >= #1/1/2018#
  • To represent a null reference (one that does not refer to any object), use a question mark. Example: [Collection Location].[Country] != ?
  • If an expression involves the use of different types, you can convert them to the same type using dedicated functions. Example: Max(ToDecimal([Height]),[Length])

Samples

A variety of sample expressions are available here: Sample Report Expressions.