2 Report Description Statements

The BREAK WHEN Statement

The BREAK WHEN statement establishes the criteria for determining the level break condition. This break, in turn, will invoke the break condition for any higher numbered levels. While active, a break condition will trigger execution of the appropriate header/trailer statement blocks. There may be one active BREAK WHEN statement for each of the nine possible break levels.

BREAK level WHEN control CHANGES [ BY increment ]

The parameters are:

level
A numeric expression evaluating to an integer from 0 to 9. This break level associates the BREAK WHEN statement to header/trailer statement. If level is 0, the BREAK WHEN statement will be ignored.
control
A numeric or string variable or expression evaluated during execution of the DETAIL LINE statement which is used to trigger the break condition.
A specific amount of space is reserved for a string expression control. If the string expression has a current length of greater than zero at execution of the BEGIN REPORT statement, this length is used. Otherwise, a default length of 18 will be used. For string variable controls, the dimensioned length will always be used. If that length is exceeded during the execution of the Eloquence Report Writer, an error will occur.
increment
A numeric expression evaluated at the execution of the BEGIN REPORT statement which establishes the incremental change necessary in control to trigger the break condition. The increment parameter may only be used for a numeric control. If not present, any change will trigger the break condition. The value of increment is rounded to the nearest integer (i.e., .01 becomes 0 which will cause an error; 1.6 becomes 2 and 2.1 becomes 2).
The break limit is set when the control variable is first given a value. The value of the increment parameter is multiplied by an integer such that it is just larger (or just smaller if increment is negative) than the value of the control variable. For example, if increment =10 and the control variable =27, then increment is multiplied by 3 for a break limit of 30. If increment is -10 and control is 5, then the break limit is 0.

Once the break limit is set, it does not change until after a break occurs. (A break occurs either because the control variable changes past the increment, or because a TRIGGER BREAK statement was executed). The break limit changes by a multiple of the increment value so that it is just larger (or smaller) than the value of the control variable.

Examples of this statement follow.


100  BREAK 1 WHEN Div$ CHANGES
110  BREAK 3 WHEN Dept$ CHANGES
.
.
.
460  Div$=C$[1,2]
470  Dept$=C$[3,4]
Lines 460 and 470 are not in the description section.


200  BREAK 2 WHEN Dim CHANGES BY 10
If the value of Dim is initially 4, a break will occur when the value of Dim is equal to or greater than 10.


300  BREAK 4 WHEN Sam CHANGES BY 2
If the value of Sam is initially 5 then changes to 1, no break will occur. When the value changes to 6 or greater, a break will occur.


400  BREAK 5 WHEN Alpha CHANGES BY -1
If the initial value of Alpha is 3 then the value changes to 2 or less, a break will occur.


Eloquence Report Manual - 19 DEC 2002