Language:


Creating a Report Generator Report - Syntax

This page describes the syntax you should use when composing "Print If" conditions, formulae and code in Report Generator reports.

---

You should use the following syntax in your "Print If" conditions, in the Formula field in the 'Selection' dialogue box and in the 'Code' dialogue box (all on the 'Data' card), and in the 'Formula' dialogue box ('Layout' card).

Relational Operators

==    is equal to
<>    is not equal to
!=    is not equal to
>    is greater than
>=    is greater than or equal to
<    is less than
<=    is less than or equal to

Do not confuse == with =. Use == when you need to compare two values, to ask if one value is equal to another. "Print If" and Overstrike conditions are appropriate places to use ==. Use = when you need to assign a value to a variable, typically after clicking the [Code] button. For example:

testvar == 1
when this appears in a "Print If" or Overstrike condition, it is asking if testvar is equal to 1.

testvar = 1
when this appears in a line of code, it is stating that testvar is now equal to 1. Any value that testvar had before this statement will be forgotten.
After clicking the [Code] button on the 'Data' card, you can enter an if statement in which both == and = are used:
if (var1 == 1) then begin var2 = 1; end;
In this example, there is first a test to see if var1 is equal to 1. If it is, then var2 is set to 1 as well. If it is not, then var2 retains the value it had previously.

Multiple Conditions

You can use multiple conditions with [Print If]. Join multiple conditions using the following logical operators:

and    both (or all) conditions must be met
or    at least one condition must be met
and !    the first condition must be met and the second must not be met.
or !    either the first condition must be met or the second condition must not be met.

Multiple Code Lines

If you need to add several lines of code to the 'Data' card of a Report Definition, the order in which those lines are listed will often be important. If you click on an existing line of code and then click the [Code] button, the new line will be added below the highlighted line. If you click on a register line and then click the [Code] button, the new line will be added above all the exiting code lines.

---

Creating a Report Generator Report:

Go back to: