Was this helpful?
.Tab Statement--Specify Tab Position
The .tab statement specifies the position on the line where the next text is printed.
This statement has the following format:
.tab | .tb | .t [[+|-] n | columnname | expression]
The parameters for the .tab statement are listed below:
+ or -
If sign is present, the new position or column is calculated relative to the current position. If sign is not present, it is set to the evaluated position n.
columnname
The name of a column in the report. You can specify the column name as a delimited identifier by enclosing it within double quotes ("), if you have previously specified the .delimid statement.
Report-Writer determines the position for the column either explicitly through the use of the .position statement, or implicitly as described in Automatic Determination of Default Settings. If columnname is specified, Report-Writer begins the next output text at the position associated with the named column.
expression
A numeric or string expression. If the expression is numeric, it must evaluate to the next print position on the line. If the expression is a string, it must evaluate to the name of a column in the report. Precede all variables that are part of the expression with a dollar sign ($).
The plus sign (+) and minus sign (-) must be explicitly stated and cannot be part of the expression.
Description
The .tab statement moves the current position marker to one of the following locations:
Specified position
Position corresponding to a specified column
Value of a numeric expression that evaluates to a specified position
Value of a string expression or variable that evaluates to a column name
Report-Writer evaluates any expressions that are used as parameters to the .tab statement during runtime.
You can specify numeric values for these parameters as either absolute or relative to the last output position.
If you do not follow the .tab statement with n, a columnname, or an expression, then the .tab statement works like a .linestart statement, with the next text beginning at the left margin of the report. The .linestart statement is described further in this chapter.
The .tab statement takes on a slightly different meaning when executed in the column formatting mode sections of a report (that is, when the .within statement is in effect and default column widths and positions are assumed). When the .tab statement is executed without a parameter in column formatting mode, Report-Writer moves the current position to the left margin of the current line. The left margin is determined by the .within statement.
For more details on column formatting mode, see the .within/.endwithin statements.
Examples
1. To output "HERE" in character position 12 on a line, use:
.tab 12
.print 'HERE'
2. To output Summary in column position $title_col, use:
.tab $title_col
.println 'Summary'
3. To output the value of the daily balance column (a delimited identifier) in position 30, use:
.position "daily balance"(30)
        ...
    .tab "daily balance"
    .print "daily balance"('+++++.NN')
4. To print two columns of figures separated by a bar:
.tab credit_sum
.right salary1
.print salary1,' |'
.right salary2
.print salary2
5. To tab forward the amount specified by the value of $col_width, use:
.tab +$col_width
.print
Last modified date: 01/30/2023