Was this helpful?
Use of Conditional and Assignment Statements
Use the conditional .if, .then, and .else statements to tell Report-Writer to execute alternative blocks of statements, under specified conditions. For example, you can test for the current line number or character position using one of the special report variables (discussed in the chapter “Report-Writer Expressions and Formats”), and then issue a .newpage or .newline statement. Or, you can execute alternative .print statements to suppress or print confidential data, based on a user's ID number stored in a declared variable.
The condition in an .if statement is a boolean expression that evaluates to true or false. Each of the following is a condition:
a clause
a boolean function
not condition
condition or condition
condition and condition
(condition)
Some examples of conditions in .if statements are:
age <= 50
not (age <= 50)
    (age <= 50) and (salary >= 40000) and
    (job = 'programming')
age > avage
You can use the .let statement to assign a value to a declared variable. For instance, you could calculate the number of years which have elapsed since an employee was hired, and assign the result to a variable for a report on employee longevity. The .let statement is often used in conjunction with the .if, .then, and .else statements.
Note that the .declare statement, used to define variables, can also be used to assign an initial (first‑time) value to the variable during the loading of the report specification. See the .Declare statement in the chapter “Report-Writer Statements.”
For more information, see Conditional and Assignment Statements in the chapter “Report-Writer Statements.”
Last modified date: 04/03/2024