RTL expressions overview

RTL Expressions use methods and variables to define runtime values for the properties of a report element.

To define an object, values are specified for the object's properties. The value for a property of a report item can be a literal value, or it can be derived from an expression that is written using the RTL Expressions language. RTL Expressions allow you to define runtime values for any property of a report item, except for those properties that display a specific set of valid values in a dropdown listbox.

Click the Value field to enter an expression in a field of the Properties View. To enter longer values, or obtain hints while typing the entry, click the fx button of the desired property to open the RTL Expression Editor:

Figure: Edit Expression dialog


This figure is a screenshot of the Edit Expression dialog, which allows you to enter an expression to determine the runtime value for a report property.

Press CTRL+SPACE and a Code Completion box appears, containing a list of the valid choices based on the context.

RTL Expressions

RTL Expressions:
  • are typed - an expression is composed of items of different types and the expression returns a particular type. The properties in the Properties View are also typed. Any expression entered as a value for a property must return the specified type. For example, the text property of a WordBox has a type of String. So, any RTL expression for the text property is expected to yield a String.
  • closely follow the Java™ syntax for expressions. The main difference is that the "new" keyword is not supported; it is not possible to create and subclass objects. RTL Expressions loosely follow the Java evaluation semantics (operator precedence, evaluation order, and so on).
  • can use 4GL variables. The variable is converted to a specific type within the expression (See Conversion table) .

RTL Classes provide member functions (methods) and member variables that you can use in your expressions. There is a class for each type of a report property.

Important: Numeric data types are limited to 15 significant digits. To avoid problems with totals in reports, do not calculate the value of an item that is part of a total using an RTL expression. Perform any calculations in the BDL program.