12. Report-Writer Statements : Column and Block Statements : .Tformat Statement—Change Format of Column Output Temporarily : Description
 
Share this page                  
Description
The .tformat statement temporarily changes the format used to print out the value of a column. After Report-Writer prints the column using this format, the effect of the temporary format is discarded, and when Report-Writer prints the next value in the column, it uses the default format.
For example, reports often include columns containing currency data. If you want to print a leading dollar sign for the currency figure only the first time it appears on a page, you could use the .tformat statement to specify a format of $$$,$$$,$$n.nn for the column in the header action for page breaks. If the normal format for printing the column is zzz,zzz,zzn.nn, then Report-Writer prints the column with a leading dollar sign only the first time it is printed on each page.
Another common use of the .tformat statement is for blanking out the unchanged values of break columns in the detail action for a report. You use the B type format (described in the Blanking Format B section of the chapter "Report-Writer Expressions and Formats") to accomplish this. Specifying a B format, with an appropriate field width as the standard format for printing a column in the detail section, causes Report-Writer to print blanks instead of the value of that column as the default action.
To ensure that Report-Writer prints each new value in the column, specify a printing format in a .tformat statement in the break header for that column. Refer to the use of the .tformat statement for the date column in Account Examples or the examples in this section.
If you specify a variable for columnname, position, and/or width, Report-Writer evaluates the variable during the loading of the report specification, before retrieving any report data.