GetSummary
Returns the value of summaryField for the current range of records when the file is sorted by breakField.
Format
GetSummary ( summaryField ; breakField )
Parameters
summaryField
- field of type summary, or an expression that returns a reference to one.
breakField
- field, or an expression that returns a reference to one. To calculate a grand summary value, use the same summary field for both the summary field and the break field parameters.
GetSummary
must be set up in the same table as the break field.
Data type returned
number, date, time, timestamp
Originated in version
6.0 or earlier
Description
This function produces subsummary values. If the file isn’t sorted by the break field, the result is blank.
When a summary field is also used as the break field, returns the summary field value for the entire found set of records (a grand summary value).
Use GetSummary to capture summary values when you want to:
- use summary values in a calculation
- display subsummary values in Browse mode or in a body part
Calculations using the GetSummary function are unstored.
Notes
- You can get similar results using a self-join relationship and Aggregate functions. For more information, see Working with related data in portals.
Example 1
GetSummary(Total Sales;Country)
returns a summary of all records pertaining to the value in the Country field.
Example 2
GetSummary(Total Sales;Total Sales)
produces a summary of all records (similar to using a summary field, which is a total of total sales).
Example 3
If(ThisCharge > 3 * GetSummary(AvgCharge;Customer), "Verify this charge", " ")
displays Verify this charge if the current charge is greater than three times the average charge.
Example 4
GetSummary(Total Sales, if(Number of Countries > 1, Country, Sales Zone))
returns a summary of Total Sales by Country if Number of Countries is greater than 1. Otherwise, it returns a summary of Total Sales by Sales Zone.