# TOT()

Syntax:

Then: a = TOT(n)

Gets a total or subtotal on field "n".

Version Ref: 3.x.

Description:

A system function that tells filePro Plus to keep a running total of a field or fields.

There is more than one way to get cumulative totals. One is to put the total-field indicator on a total or subtotal line of a report. Another is:

Then: a=a+n

However, neither is as flexible as the TOT function. In the first case, TOT lets you total conditionally; " = " doesn't. In the second case, TOT lets you write statements like:

Then: tt = tot(22)*tot(23)

or:

Then: tt = tot(22*23)

Note that the results of the two equations are quite different from each other. In record 1, field 22 contains a value of 10 and field 23, a value of 12. In record 2, field 22 contains a value of 3 and field 23, a value of 8. The result of equation 1 is 260: (10 + 3)*(12+ 8). The result of equation 2 is 144: (10*12) + (3*8).

Examples:

You want to print a report that lists average sales per sales representative, maximum and minimum sales, and at the end of the report, the total number of sales transactions for all representatives.

Field 22 is "Total Sales." The element would be written as follows:

Then: TS=TOT(22)

To print the total, put *TS on a total line of the report format.