7.67.52015-05-06

Combine Global Conditions

You can use either the Condition properties dialog box or the Object Inspector to combine global conditions. When you combine conditions, it is important to understand the significance of the position in which a condition appears in the Structure area. The position of a condition in the Structure area both determines the conditions with which you can combine it, and limits how you can move it in the Structure area. More precisely, you can combine a condition only with conditions that appear above it, and you cannot move a condition above any condition it references.

You combine conditions by creating a valid Boolean expression that references conditions as variables. You construct the expression using Boolean logic, and the four Boolean operators: AND, OR, NOT, ().

Operator

Description

Example

AND

Operates on two conditions. The result is True only if BOTH conditions are True.

&red AND &round

OR

Operates on two conditions. The result is True if EITHER condition is True or BOTH conditions are True.

&blue OR &square

NOT

Operates on a single condition. The result is the inverse of the condition.

NOT (&over_50)

()

Assigns the highest precedence to its contents. See below for an explanation of precedence rules.

The expressions you create using these operators can be either simple or complex. For example:

&red OR &blue

&over_50 AND &under_300 AND NOT (&red) AND &round

(NOT (&red OR &blue)) AND (&big OR (&round AND &tin))

Precedence rules determine the order in which PlanetPress Design evaluates the expression. The final result of an evaluation can depend on the precedence rules. For example, consider that you want a line item on an invoice to print only if the part number is greater than 50, and the part is either red or round. You write:

&over_50 AND &red OR &round

Depending on the precedence rules, this could also mean print the line item only if both the part number is greater than 50 AND the part is red, or the part is round. In the latter case, line items for parts that are round print, regardless of whether their part number is greater than 50.

PlanetPress Design uses standard Boolean precedence rules:

Operator

Precedence

()

1

AND

2

NOT

2

OR

3

Thus, the contents of parentheses are always evaluated first. If two operators in an expression have the same precedence, they are evaluated left to right. Since parentheses have the highest precedence, you can override the precedence of a lower-precedence operator by enclosing it in parentheses. In the following example, although the OR operator has a lower precedence than the AND operator, the OR expression evaluates before the AND expression because parentheses enclose the OR expression.

(&before_2002 OR &under_50) AND &over_300

Thus, to return to the earlier example, to print the line item only if the part number is greater than 50, and the part is either red or round, you would rewrite the expression as:

&over_50 AND (&red OR &round)

To combine global conditions using the Condition properties dialog box:

  1. In the Structure area, double-click the condition to open the Condition properties dialog box for the condition with which you want to combine one or more existing conditions:

  2. In the Condition properties dialog box, click Concatenation.

    The name of the condition you are defining appears in the Completed condition box, and the names of the conditions you can combine with it appear in the Conditions available for concatenation box.

  3. Do one or more of the following to combine conditions into a valid Boolean expression. As you work, PlanetPress Design reports any syntax errors in the Status area.

    A. Status area

    • Type directly in the Completed condition box. Names of conditions and Boolean operators are both case-insensitive. Note that if you want to use a NOT operator, you must enclose the condition on which you want it to operate in parenthesis. Thus you enter NOT (&black) rather than NOT &black.

    • Drag and drop conditions from the Conditions available for concatenation box. Click on the name of the condition you want to add, drag it to the Completed condition box, release it at the position at which you want to insert it in the expression, and choose either And or Or from the menu PlanetPress Design displays. Legal positions for insertions are displayed in blue as you drag. Releasing over a condition name inserts the condition after that condition. Releasing over an opening parenthesis inserts the condition before that opening parenthesis. Releasing over a closing parenthesis inserts the condition after that closing parenthesis.

    • Apply the NOT operator to a condition by right-clicking the condition and choosing Insert “Not” Operator. PlanetPress Design encloses the expression on which you clicked in parentheses, and precedes it by the NOT operator.

    • Remove the NOT operator from a condition by right-clicking the condition and choosing Remove “Not” Operator.

    • Delete a condition by right-clicking the condition and choosing Delete Item from Condition. Note that you cannot delete the condition you are currently defining.

    • Delete any or all conditions by highlighting the section you want to delete and pressing BACKSPACE, or by backspacing through the section.

  4. Click OK.

    If the Boolean expression contains a syntax error and you attempt to close the Condition properties dialog box, PlanetPress Design returns the focus to the Concatenation area of the Condition properties dialog box. You must fix the error to close the dialog box.

To combine global conditions using the Object Inspector:

  1. In the Structure area, select the condition to which you want to add one or more existing conditions.

  2. In the Object Inspector, locate the Combined condition property.

  3. In the Combined condition property, enter a valid Boolean expression that references one or more of the conditions that appear above the currently selected condition in the Structure area, and describes how you want to combine those conditions. This expression must reference the condition whose Combined condition property you are editing.