12. Report-Writer Statements : Page Layout and Control Statements : .Need Statement—Keep Lines Together : Examples
 
Share this page                  
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.