At times, one needs to group the records in the report by a specific field. I have created a small sample app to create a 'group by a field" report.
Here is the app. Group By Reports
The app uses the data from the already available sample app called “Histogram”
While browsing the app in the editor, please take a look at following relevant details
- The VC “RefSize” .This Ref type VC classifies each of the records by assigning it the " group by field category" to which the record belongs to. In the sample app , the group by field is “Size” and the categories are “Small” ,“Medium”, “Big”
This “RefSize” ref type field automatically creates a “related records” reverse reference list type field with all the grouped records being grouped in only one “related records” VC for each category of size (“Small” ,“Medium”, “Big”). Basically this rev reference columns creates grouped “child records” (within the same table ) for each category.
There is a slice called “SizeGroup” . It selects only those records where the corresponding reverse reference column described in 2) above is non empty. In short, the slice selects only one record per size category with all associated grouped records for that category being “child records” in the reverese reference column.
The report template in Behavior --> Workflow options has
A) One outer loop based on the slice described in 3) above that prints only one “parent” record for each group category and works as a kind of “group title”
B) An inner loop created with all “child records” from the reverse reference column described above in 2) that print all group records for that particular size category.
- There is an action “Send GroupBy Report” in each record of the table that can be used to fire the report once you download the app.
The sample report looks like below where “Group by Size: Big” is the group by category outer loop and table is inner loop of records belonging to that group.
I had participated in a similar post thread mentioned below and thought that a simpler sample app based on that discussion could be useful and so the above post. Hope this is useful and helps someone.