Creating Labels to Identify Data
Labels enable you to provide meaningful and distinct names for the following report elements that are otherwise identified by generic labels:
- Row and column totals. See Creating a Label for a Row or Column Total.
- Subtotals for sort groups. See Creating a Label for a Subtotal and a Grand Total.
- Rows in a financial report. See Creating a Label for a Row in a Financial Report.
Creating a Label for a Row or Column Total
A label for a row or column total identifies the sum of values for two or more fields. A label draws attention to the total. It is particularly important that you create a label for a row or column total if you have both in one report.
For related information, see Including Totals and Subtotals.
Create a Label for a Row or Column Total
fieldname [AND] ROW-TOTAL[/justification][/format] [AS 'label'] fieldname [AND] COLUMN-TOTAL[/justification] [AS 'label']
fieldname [AND] COLUMN-TOTAL[/justification] [AS 'label']
where:
L
which left justifies
the label.
R
which
right justifies the label.
C
which
centers the label.
For related information, see Justifying a Heading, Footing, Title, or Label.
You can also specify a row or column total with the ON TABLE phrase. With this syntax, you cannot include field names with ROW-TOTAL. Field names are optional with COLUMN-TOTAL.
ON TABLE ROW-TOTAL[/justification][/format] [AS 'label'] ON TABLE COLUMN-TOTAL[/justification] [AS 'label'] [fieldname fieldname fieldname]
If a request queries a field created with COMPUTE, the value of that field is included in a row or column total. Keep that in mind when customizing a label that identifies the total.
Creating a Label for a Row and Column Total
This request creates the label Total Population by State for the row total, and the label Total Population by Gender for the column total. The format D12 for ROW-TOTAL displays that data with commas.
TABLE FILE GGDEMOG PRINT MALEPOP98 FEMPOP98 ROW-TOTAL/D12 AS 'Total Population by State' BY ST WHERE (ST EQ 'WY' OR 'MT') ON TABLE COLUMN-TOTAL AS 'Total Population by Gender' ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The output is:
Creating a Row Total Label With ACROSS
This request adds the populations of two states, sorts the information using the ACROSS phrase, and labels the row totals as Total by Gender. There are two row totals within the Total by Gender column, Male Population and Female Population.
TABLE FILE GGDEMOG SUM MALEPOP98/D12 FEMPOP98/D12 ROW-TOTAL AS 'Total by Gender' ACROSS ST WHERE ST EQ 'WY' OR 'MT'; ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The output is:
Creating a Label for a Subtotal and a Grand Total
Frequently, a report contains detailed information for a sort group, and it is useful to provide a subtotal for such a group, and a grand total for all groups at the end of the report.
For related information see Including Totals and Subtotals.
Create a Label for a Subtotal or a Grand Total
{BY|ON} fieldname {SUB-TOTAL|SUBTOTAL|COLUMN-TOTAL} [MULTILINES] [field1 [AND] field2...] [AS 'label'] [WHEN expression;]
where:
Creating a Label for a Subtotal and a Grand Total
This request creates a customized label for the subtotal, which is the total dollar amount deducted from employee paychecks for city taxes per department; and the grand total which is the total dollar amount for both departments.
TABLE FILE EMPLOYEE SUM DED_AMT BY DED_CODE BY DEPARTMENT BY BANK_ACCT WHERE DED_CODE EQ 'CITY' WHERE BANK_ACCT NE 0 ON DEPARTMENT SUBTOTAL AS 'Total City Deduction for' ON TABLE COLUMN-TOTAL AS '**GRAND TOTAL**' ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
In the output, the department values MIS and PRODUCTION are included by default in the customized subtotal label.
Creating a Label for the Subtotal of a Specific Field
This request creates a customized label, Order Total, for the subtotal for LINEPRICE. It uses the default label TOTAL for the grand total.
TABLE FILE CENTORD PRINT PNUM QUANTITY LINEPRICE BY ORDER_NUM SUBTOTAL LINEPRICE AS 'Order Total' WHERE ORDER_NUM EQ '28003' OR '28004'; ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The output is:
Create a Label for the Subtotal of a Calculated Value
{BY|ON} fieldname {SUMMARIZE|RECOMPUTE} [MULTILINES] [field1 [AND] field2...] [AS 'label'] [WHEN expression;] ON TABLE {SUMMARIZE|RECOMPUTE}
where:
You can also generate a subtotal with the ON TABLE phrase:
ON TABLE {SUMMARIZE|RECOMPUTE}
Creating a Label for the Subtotal of a Calculated Value
This request creates a customized label for the subtotal, including the calculation for the field DG_RATIO, created with COMPUTE.
TABLE FILE EMPLOYEE SUM GROSS DED_AMT AND COMPUTE DG_RATIO/F4.2 = DED_AMT / GROSS; BY DEPARTMENT BY BANK_ACCT WHERE BANK_ACCT NE 0 ON DEPARTMENT SUMMARIZE AS 'SUBTOTAL FOR ' ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
In the output, the department values MIS and PRODUCTION are included by default in the customized subtotal label. The default grand total label is TOTAL.
Creating a Label for a Row in a Financial Report
Financial Modeling Language (FML) meets the special needs associated with creating, calculating, and presenting financially oriented data. FML reports are structured on a row-by-row basis. This organization gives you greater control over the data incorporated into a report and over its presentation.
You identify rows by labels that you can customize for accurate data identification and format to enhance the visual appearance and clarity of the data.
For details on FML reports, see Creating Financial Reports With Financial Modeling Language (FML).