Was this helpful?
.Need Statement--Keep Lines Together
The .need statement ensures that a specified number of text lines is printed together on the same page.
.need | .ne nlines| expression
The parameters for the .need statement are as follows:
nlines
The number of lines in the text block to remain together.
expression
A numeric expression that evaluates to the total number of lines in the text block to remain together. Precede all variables that are part of the expression by a dollar sign ($).
Description
The .need statement allows you to ensure that groups of text lines are not broken across pages of the report. Report-Writer performs conditional page breaks, to keep the specified or variable‑specified lengths of text blocks together. You can use this statement to make sure that Report-Writer keeps all lines of text in the headers, and such, on the same page. For examples of placing the .need statement, see the appendix "Report-Writer Report Examples."
Report-Writer evaluates any expressions used as parameters to the .need statement during runtime.
Examples
1. Make sure that the break header is on the same page.
.need 3
.print 'Header for account:',acct
.newline
.print '------ --- -------'
.newline 2
2. In this example, the report ensures the label information can be printed on varying sized label forms. The value of label_size is the number of lines per label. The printing of the company name is dependent on a record meeting the criteria of the condition.
.need $label_size
.if company != '' .then
    .println company
    .let address_lines = 4
.else
    .let address_lines = 3
.endif
.println name
.println address
.println city, state, zip
.newline $label_size - $address_line.
Last modified date: 08/28/2024