Using conditional processing

ReportWriter can use conditional processing for fields and detail lines. The field or line is printed on the report only when the conditional is true.

Assigning a conditional to a field

A conditional assigned to a field is evaluated before each record. If the condition is true, the field is printed. If the condition is false, the field is not printed. You can connect up to five conditionals together (with AND and OR) and assign them to a single field.

When a conditional is assigned to a field, a letter C displays in the FLAGS column for that field in the Print Fields list.

For example, let’s assume we want to print an asterisk after the Sales year-to-date field, but only if Sales year-to-date contains a value of $500,000 or more. First, we’d define a text field that contains an asterisk. (See Creating a text field for information about defining text fields.) Then we’d select that field as a field to print and specify a conditional for it, as illustrated in figure 1.

1. Specifying a conditional to suppress printing.

1. Highlight the field.
2. Select Field functions > Specify conditions to display the Condition Criteria list. As you define conditions, they are added to the end of this list.
3. Enter data in each field as instructed below.

Connect

If this is the first condition defined for this field, skip this field.

If a condition has already been defined for this field, enter the connection operator (AND or OR) to indicate how this condition is connected to the first condition. AND designates that the two conditions must both be true for a record to match. OR designates that a record will be considered to match if one or the other condition is true.

Comparisons occur from the top of the list to the bottom. For example,

a AND b OR c

is not the same as

b OR c AND a

To define parenthetical type conditionals like (a AND b) OR (c AND d), see Evaluation order for parenthetical selection statements.

Field

Enter the name of the field you want to use as a conditional. Note that the fields you specify as conditionals don’t have to be fields to print.

To select from a list of available fields that can be used in the conditional, select Field functions > List selections. See Selecting fields for more information.

If you select an arrayed field for use in a conditional, the Field Subscript window is displayed. See Selecting an arrayed field for details on entering subscript information.

To use only part of a field in a conditional, you can specify a range. See Using only part of a field for comparison (ranging).

Compare

Select one of the comparison operators:

EQ = Equal to

NE = Not equal to

LE = Less than or equal to

LT = Less than

GE = Greater than or equal to

GT = Greater than

Value

 Enter either a specific value or the name of a field to which data in your records will be compared. For detailed information about the rules that apply to comparisons, see Completing the Value field.

In our asterisk example, we specified SALES_YTD as the field you want to compare, GE (greater than or equal to) as the comparison operator, and 500000 as the comparison value. This means that if the equation (SALES_YTD).GE.{500000} is true (in other words, the value in the Sales year-to-date field is greater than or equal to 500,000), the text field that contains the asterisk will be printed.

4. Exit the window; the new conditional displays on the Condition Criteria list.
5. To define additional conditions, select Condition functions > Add condition.
6. To return to the list of fields to print, press the Exit shortcut while in the Condition Criteria list.

Defining a conditional by copying an existing one

1. Highlight the conditional you want to copy.
2. Select Condition functions > Copy condition.

The Criterion Definition window is displayed with a copy of the current conditional.

3. Edit any value, including the connect or comparison operators.
4. Exit the window when you have finished making changes.

The new conditional is added to the Condition Criteria list.

Editing a conditional

1. Highlight that conditional in the Condition Criteria list.
2. Press Enter.

The Criterion Definition window is displayed with the current conditional.

3. Edit any value.

To display the list of connection or comparison operators, type any letter at the Connect or Compare prompt, respectively.

4. Exit the window when all information is correct.

Reordering conditionals

1. Highlight the conditional you want to move.
2. Select Condition functions > Reorder conditions.

The conditional is enclosed in square brackets ([ ]). (To see the close bracket, press the Scroll right shortcut.)

3. Use the Up Arrow and Down Arrow keys to move the conditional to the desired location.
4. When the conditional is where you want it, select Reorder conditions again.

If you move the conditional that you created first, or if it is no longer the primary conditional, ReportWriter assigns it a default AND connector.

Deleting a conditional

1. Highlight the conditional in the Condition Criteria list.
2. Select Condition functions > Delete condition.

Assigning a conditional to a detail line

You can assign a conditional to any detail record line. This is useful when you want to suppress one or more detail lines within a multi-line detail record. To suppress single-line detail records or all lines of a multi-line detail record, use the Selections to make function (see Defining selection criteria). The detail record line is printed on the report only if the conditions specified in the conditional are true. You can connect up to five conditionals together (with AND and OR) and assign them to a detail line.

1. Select Line functions > Specify line conditions to display the Condition Criteria list.
2. See Assigning a conditional to a field for information on completing the fields.

If you select an arrayed field for use in a conditional, the Field Subscript window is displayed. See Selecting an arrayed field for details on entering subscript information.

3. To save your conditional and return to the Condition Criteria list, exit the window. The word “Conditioned” is displayed at the bottom of the layout window.
Note

Keep the following design limitation in mind: If all lines in a multi-line detail record have conditionals, and all evaluate to false, the record is still counted in the total record count for the report. Use a subtotal access field to access the record count instead.

Modifying a detail line conditional

To copy, edit, move, or delete detail line conditionals, refer to the following sections:

Defining a conditional by copying an existing one

Editing a conditional

Reordering conditionals

Deleting a conditional