Difference between revisions of "Rollup Summary Fields"
imported>Aeric |
imported>Aeric |
||
Line 10: | Line 10: | ||
*''Master Objects'' (created via [[Master-Detail relationship]]) | *''Master Objects'' (created via [[Master-Detail relationship]]) | ||
*Elements that use [[Filter Expressions in Reports and Data Policies|Filter Expressions]]: | *Elements that use [[Filter Expressions in Reports and Data Policies|Filter Expressions]]: | ||
:*[[Data_Policy#Build_a_Calendar_Based_Data_Policy|Calendar Based Data Policy]] | :*[[Data_Policy#Build_a_Calendar_Based_Data_Policy|Calendar Based Data Policy]] | ||
:*[[Filter_by_Field_Value|Filters in Views]] | :*[[Filter_by_Field_Value|Filters in Views]] |
Revision as of 01:01, 12 October 2012
Rollup Summary Fields provide quick access to complex metrics in large databases.
About Rollup Summary Fields
Rollup calculations are done in the background, on a schedule specified when the field is created, and include such calculations as: Record Count, Sum, Average, and Max/Min operations. Template:Tenantfeatures
Rollup Summary Fields can be used with the following platform elements:
- Master Objects (created via Master-Detail relationship)
- Elements that use Filter Expressions:
In these one-to-many relationships, a Master-Detail relationship is created, where data from the detail object can be summarized and the resulting calculations are rolled up to the master-level object.
How it Works
In an order management system, a Master object and a Detail object are defined. In the resulting Master object view, the Rollup Summary Fields provide quick analysis of order history, by Customer name with total sales listed for each customer.
- The Master object is Orders
- The Master object contains these fields:
- customer_name
- order
- Rollup Summary Field, order_amount, with these parameters:
- Label: Order Amount
- Display Type: Rollup Summary
- Summary Object: Line Items
- Rollup Type: SUM
- Summary Field: amount
- Summary Calculation Mode: Asynchronous
- The Detail object is Line Items
- The Detail object contains these fields:
- Lookup field to orders, order
- item_number
- item_description
- order_number
- quantity
- each
- unit_price
- amount
- Order Data
order customer_name 1001 Bob's Bakery 1015 Sally's Sweets
- Line Item Data
order item_number item_description quantity each unit_price amount 1001 B102 sticky buns 2 doz $3.95 $7.90 1001 C220 chocolate chip cookies 1 doz $2.95 $2.95 1015 W32 whole wheat bread 1 loaf $4.50 $4.50 1015 B43 butter cookies 3 doz $1.55 $4.65 1015 C56 carrot cake 1 large $9.95 $9.95
- Rollup Summary Action
Open the Orders object, and see the Rollup Summary calculations in the default View:
order customer_name order_amount 1001 Bob's Bakery $10.85 1015 Sally's Sweets $19.10
- Considerations
- By default, calculations on Rollup Summary Fields are Asynchronous, which means that values are updated (recalculated) on a regular schedule, defined at the server level
- Learn more: Synchronous Rollup Summary Fields
- Available Rollup Calculation Types are:
- Count
- Sum
- Average
- Min
- Max
- See Eligible Field Types based on Calculation Type for more information
Add a Rollup Summary Field
To add a Rollup Summary Field:
- Using objects in a Master-Detail relationship (or alternate objects, listed above), follow the instructions at Create a Lookup Field
- Optionally, define Record Selection Criteria to determine the records to display in a Lookup Window; learn more: Customize Lookup Field Options
Synchronous Rollup Summary Fields
The option for Synchronized calculations means that records are updated immediately, whenever a value dependent on the Rollup Summary Field is updated or changed in any way. This creates a live data feed, with up-to-the-minute metrics.
Rollup Summary Fields are calculated asynchronously by default, which is adequate for most applications. In order to use Synchronous calculation in Rollup Summary Fields, the Synchronous Rollup Summary Fields option in Manage Tenant Capabilities must be enabled.
- Considerations
-
- The Synchronous option can cause a delay in displaying the Rollup Summary Field values, especially if a large number of records must be accessed for calculations
- A maximum of five (5) Rollup Summary Fields are permitted per Tenant
- The number of Rollup Summary Fields allowed are defined in Manage Tenant Capabilities
Eligible Field Types based on Calculation Type
Calculation Type Eligible Field Types Return Types Count All All Sum Number (integer), number with decimals, currency, percent (%), formula fields Number (integer), number with decimals, currency or percent (%) Average Number (integer), number with decimals, currency, percent (%), formula fields Number (integer), number with decimals, currency or percent (%) Min Number (integer), number with decimals, currency, percent (%), formula fields Number (integer), number with decimals, currency, percent (%), date or date/time Max Number (integer), number with decimals, currency, percent (%), formula fields Number (integer), number with decimals, currency, percent (%), date or date/time
Technical Considerations
- Rollup Summary Fields cannot be created for a Detail object that is checked out (Learn more: Versioning)
- A Rollup Summary Field can be deleted, which deletes all associated parameters, including: Name, Title, Summary Object, Rollup Type, Summary Field and Summary Calculation Mode
- When updating a Rollup Summary Field, these fields can be modified: Title, Lookup Filters and Summary Calculation Mode
- However, these fields cannot be changed: Display Type, Summary Object, Rollup type or Summary Field
- A Summary Field that is used in a Rollup Summary cannot be deleted (because the Summary Field links to a field in the Detail Object)
- If a Detail object is deleted and a Rollup Summary Field exists in the Master object, then the field display type reverts from Rollup Summary to match the field display type originally specified by the field in the Detail object
- If the Synchronized Rollup Fields option is enabled in Manage Tenant Capabilities, then the [Asynchronus] and [Synchronous] calculation options become available when creating a Lookup field in a Master-Detail relationship
- When a record in a Detail object is deleted, the Rollup Summary Field is recalculated according to the defined Asynchronus/Synchronous option
- If a record in a Master object is accessed from a View while the Rollup Summary Field is being calculated, an icon will be displayed in place of the value, indicating that a calculation is in progress
- Implementation
- Rollup Summary Fields:
- are universal, read-only fields
- should not be used to build filter criteria for Formulas, Data Policies, Validations, Indexes or Searches
- cannot be created based on a Rollup Summary Field
- can be created only in objects of type Master
- ISCHANGED() function cannot be used on Rollup summary fields.
- Packaging
- If the object is a master object with rollup summary field, the detailed object needs to be added as a dependent item
- Mass Update cannot be performed on Rollup Summary Fields
- Use ISNULL in Formula Functions with Rollup Summary Fields