Sample App for "Group By A Field" in Reports

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

  1. 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”
  1. 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 :slight_smile: ) for each category.

  2. 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.

  3. 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.

  1. 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.

8 Likes

This is ultra smart solutions!! I m impressed.
Thank you very much for sharing useful tricks, will add to my existing and incoming new apps! :smile:

1 Like

For some use cases, we have separate Master (ref) table which is going to be used for GROUPING.
In that case, how would you recommend that we twist your sample apps? For instance, we create another table on your sample app, where we store sizes, “Smarll,Medium,Big”.

Hi @tsuji_koichi,

Thank you. You have a very valid and practical point. Do you have some example in mind for different table master? I was thinking orders and order details. But in that case, when an order is complete, all chidren have also complete status.Also in such cases , I believe the workflow template lists child records in its default expression creations?

Sure, hang on and give me bits, will revert after testing my thoughts etc.

Sure, thank you.