Roll-up Summary Fields

,

In the previous discussion on master-detail relationship, there was a rather tempting mention of a feature called Roll-up Summary Fields.

Roll-up Summary Fields, sometimes referred to as RSFs, perform different types of calculations, based on the child records in a master-detail relationship. A Roll-up Summary Field is available just like any other field, in pages, related list views and reports.

You can use Roll-up Summary Fields to obtain the following aggregates:

  • COUNT - holds the number of child records in the master-detail relationship

  • SUM - holds the sum of the values of the child record field indicated

  • MAX - holds the maximum value of the child record field indicated

  • MIN - holds the minimum value of the child record field indicated

You can also add criteria to limit the aggregation to a subset of all child records. For the first Roll-up Summary Field in your recruiting application, you only need to count the number of applicants for a particular position.

1.
Select Setup Objects Position, and then click New in the Custom Fields & Relationships section to add a new field to the object.

2.
Select Roll-up Summary Field as the data type and click Next. Remember that this data type was not enabled when you were initially adding fields for the Position record. The Force Platform Setup menu only enables this choice if the object is a parent in a master-detail relationship, a requirement for Roll-up Summary Fields.

Also notice that the Master-Detail Relationship data type is no longer available. Since Position is a master to Job Applications, the object cannot be a child in another master-detail relationship.

3.
Give the new field a Field Label of Number of Applications, and an appropriate description and help text, then click Next to bring up the page shown below.



Figure 43. Defining a Roll-up Summary Field


4.
Select Job Applications as the Summarized Object, the only choice available. Select COUNT as the Roll-Up Type, which does not require you to select a field to aggregate, since you are counting records. You do not need to define a filter, so click Next.

5.
Accept the default field-level security choices and click Next.

6.
Complete your work by clicking Save on the final page of the wizard.

If you go immediately to the Positions tab and select a record, you see a small hour glass next to the new Roll-up Summary Field. This indicator means that the Force Platform database is still calculating the value for the new summary – a process that takes very little time for small numbers of objects, as you have in this example, but could take a while if you add a summary field to a master with many detail records.

Even if the initial calculation takes a bit of time, keep in mind that this initial aggregation only occurs once. Subsequent modifications to child records appear with virtually no delay in the display of a Roll-up Summary Field.

The use of a Roll-up Summary Field in this particular scenario has been very simple, but through the use of selection conditions and other aggregations, you can derive quite a bit of information from your data. You will see the use of Roll-up Summary Fields to aggregate data further in subsequent chapters of this book, but for now, your initial introduction to data objects and relationships is complete.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.230.30