Referring to Rows in Calculations

How to:

FML assigns a default positional label to each TAG, DATA, RECAP, and PICKUP row. These positional labels are automatically prefixed with the letter R, so that the first such row in the model is R1, the second is R2, and so on. You can use these labels to refer to rows in RECAP expressions.

Note: Default labels are not assigned to rows that contain underlines, blank lines, or free text, since these row types need not be referenced in expressions.

When you refer to rows in a RECAP expression, you can:

If you assign an explicit label, the positional label (R1, R2, and so on) is retained internally.

Note that an explicit label is not needed for a RECAP row, because the name of the calculated value on the left of the equal sign can be used as a label.

In addition to their role in RECAP calculations, you can use labels to format rows in an FML report. For more information, see Formatting an FML Report.

Syntax: How to Assign an Explicit Row Label

rowtype [AS 'text'] LABEL label [OVER]

where:

rowtype

Can be a TAG, DATA, or PICKUP row.

AS 'text'

Assigns a different name to the row for the report. Enclose the text in single quotation marks (').

label

Assigns a label to a row for reference in a RECAP expression or a StyleSheet declaration. The label can be up to 66 characters and cannot have blanks or special characters. Each explicit label you assign must be unique.

Note: You should not create an explicit label with a name of the form Rn, as that type of name is used for default positional row labels assigned by FML and may cause problems with subsequent RECAPs.

Even if you assign an explicit label, the positional label (R1, R2, and so on) is retained internally.

Example: Referring to Default Row Labels in RECAP Expressions

In this example, FML assigns account 1010 the implicit label R1, account 1020, the implicit label R2, and account 1030, the implicit label R3. Since no label is assigned to a BAR row, the RECAP row is assigned the implicit label R4.

TABLE FILE LEDGER
SUM AMOUNT FOR ACCOUNT
1010 AS 'CASH ON HAND'      OVER
1020 AS 'DEMAND DEPOSITS'   OVER
1030 AS 'TIME DEPOSITS'     OVER
BAR                         OVER 
RECAP TOTCASH = R1 + R2 + R3; AS 'TOTAL CASH' 
END

The output is shown as follows.

                 AMOUNT
                 ------
CASH ON HAND      8,784
DEMAND DEPOSITS   4,494
TIME DEPOSITS     7,961
                 ------
TOTAL CASH       21,239

Referring to Explicit Row Labels in RECAP Expressions

The following request assigns the labels CA, AR, and INV to three tag rows, which are referenced in the RECAP expression.

TABLE FILE LEDGER
SUM AMOUNT FOR ACCOUNT
10$$ AS 'CASH'                   LABEL CA    OVER
1100 AS 'ACCOUNTS RECEIVABLE'    LABEL AR    OVER
1200 AS 'INVENTORY'              LABEL INV   OVER
BAR                                          OVER 
RECAP CURASST/I5C = CA + AR + INV; 
END

The output is shown as follows.

                     AMOUNT
                     ------
CASH                 21,239
ACCOUNTS RECEIVABLE  18,829
INVENTORY            27,307
                     ------
CURASST              67,375

Note that the RECAP value could subsequently be referred to by the name CURASST, which functions as an explicit label.

Using Labels to Repeat Rows

In certain cases, you may wish to repeat an entire row later in your report. For example, the CASH account can appear in the Asset statement and Cash Flow statement of a financial analysis, as shown below.

TABLE FILE LEDGER
SUM AMOUNT FOR ACCOUNT
"ASSETS"                          OVER
10$$ AS 'CASH' LABEL TOTCASH      OVER
.
.
"CASH FLOW"                       OVER
RECAP SAMECASH/I5C = TOTCASH; AS 'CASH'
END

When you refer to the CASH row the second time, you can use a RECAP calculation (with a new name) and refer to the label, either explicitly (TOTCASH) or implicitly (R1), in the row where CASH was first used.

Tip: If you set the FORMULTIPLE parameter ON, you can repeat the row without giving it another name. For more information, see Creating Rows From Multiple Records.