GetSummary()

Category: Summary

Syntax: GetSummary ( summaryField; breakField )

Parameters:

summaryFieldA field of type summary, or an expression that returns a reference to one.

breakFieldA field, or an expression that returns a reference to one.

Data type returned: Number, Date, Time, Timestamp

Description:

The GetSummary() function returns the value of summaryField when summarized by breakField. The found set must be sorted by breakField for GetSummary() to return the proper value.

GetSummary() returns the same values that you would see if you were to place the specified summary field in a subsummary report. GetSummary() is necessary when you need to use summarized values in calculation formulas or for display purposes while in Browse mode.

Note, you could also achive similar results using a self-join relationship and aggregate functions.

To calculate a grand summary value, use the same summary field for both the summary field and the break field parameters.

Examples:

Given the following record set, sorted by Country, and a summary field called Sum_Sales defined as the Total of Sales:

Country

Region

Sales

U.S.

North

55,000

U.S.

South

45,000

China

North

35,000

China

South

40,000

A field SalesByCountry defined as

GetSummary (Sum_Sales; Country)

returns 100,000 for the two U.S. records and returns 75,000 for the two China records.

Категории