Was this helpful?
.Break Statement--Specify Break Columns
The .break statement specifies the break columns for the report and the order in which they should break.
The .break statement has the following format:
.break | .brk columnname{, columnname
The parameters for the .break statement are:
columnname
Name of a column in the table used as the basis for your report, or the label for a column in the result column list of the specified query.
The columnname can be expressed optionally as a delimited identifier or a variable. The comma (,) must be stated explicitly and cannot be part of a columnname variable. You can specify columnname as a delimited identifier by enclosing it in double quotes ("), if you have previously specified the .delimid statement.
$columnvariable
Variable whose value is a column name. The variable must be preceded with a dollar sign ($).
Description
You can use the optional .break statement to specify the break columns if no .sort statement has been specified, or to override the default break columns created by the .sort statement. The order in which Report-Writer processes the break statements is the order in which they appear in the specified break list. A break on one column in the list produces a break on all subsequent columns in the list.
If a variable is specified as the column, Report-Writer evaluates the columnname during the loading of the report specification, before retrieving the data.
If a .sort statement is not specified, all columns that have .header or .footer statements must be included in the break list.
If you specify an order by clause in a .query statement, a .break statement that lists the columns in the order by clause must also be specified. The .query statement does not create default column breaks as does the .sort statement.
Note:  When using a variable for columnname, the variable must be specified identically in corresponding .sort, .header, and .footer statements.
Examples
1. The following example breaks on the columns, state and city of employment (a delimited identifier). The order to sort the rows retrieved from the database appears in the .query statement. The .break statement is required to identify the sort columns to Report-Writer.
.query  
      select *
        from emp
        order by state, "city of employment"
.break state, "city of employment"
2. The following example overrides the original sort order specified in the .sort statement by using the .break statement. This might be done so that a change in the second sort column does not trigger a break on the third column. Note the consistent usage of variable names.
.sort     $first_col :a,
          $second_col :a,
          $third_col :a
.break    $first_col, $third_col
Last modified date: 11/09/2022