"Dynamic group-by" inline list

Hi, in case this is not a common workaround, happy to share an approach to have an inline list “dynamically grouped by” a choice component.
This enables users to choose how to group-by the results of the inline list (+ to reduce the nb of inline list by x if we had 1 by ‘group-by’ criteria)

Challenge:
I’ve got 1 tab for [Search] and 1 for [Content]; I had to separate them because the [Search] tab displays elements of various tabs.
In the [Search] tab, I have a ‘choice component’ for the ‘group-by’ options.
=> But the standard “group-by” feature of the inline list is linked to the [Content] tab, while the ‘choice component’ is linked to the [Search] tab.

Approach:
1/ tab [Datalist] - GSheet: List of criteria in 1 column to which will be linked the ‘choice component’ of ‘Group by’ options
2/ tab [Search] - Glide layout: ‘Choice component’ (with User specific field) linked to [Datalist] of different possible ‘Group by’ criteria
3/ tab [Content] - Glide databuilder: ‘Single value’ (select ‘first’) bringing back from the [Search] tab the user specific field’s value created by the ‘choice component’
4/ tab [Content] - Glide databuilder: ‘If-then-else’ to match the ‘Single value’ by each value (entered manually) of the ‘List of criteria’ with the related various columns of the [Content] tab (attention : if the [datalist] criteria are changed, even in orthograph, the change must be also done in this if-then-else)
5/ tab [Search] - Glide layout: ‘group-by’ the inline list by the if-then-else of the [Content] tab

Of course, @ThinhDinh and other Glide-Kings (@Robert_Petitto, @Jeff_Hager etc) will find a simpler way to do it … and I will have lost 2h for nothing, but now I’m used to it :slight_smile:

12 Likes

That’s a really cool idea. Can’t think of any way to improve on it. I’ll have to remember this for the future.

2 Likes

This is so perfect. I need this for one of my App. Thank you so much.

1 Like

Does this also allow for multiple levels of group by. So for example If i wanted to group Media and then by author and expose the items.

Thanks master!
And a new cool thing that I discovered with this technic, is that we can apply it on Charts, to build a dynamic chart with just 1 choice component + 1 chart.

Updated simplified approach if the inline list (or graph) data to display are in the same tab than the User Specific data selected via Choice component.

OBJECTIVE
Display an inline list according to the selection of a choice component (ex. gender) AND grouped by the categories of this selection (ex.woman, man)

SOLUTION
In the dataeditor:
- “User specific” field: hosting the choice component selection
- “Single Value” field (select ‘First’): linked to the “User Specific” field
- “IF” field: with “If Single Value is (‘choice option 1’ entered manually), then (column related to this option), idem for option 2, 3…”
NB: if the words of the source values of the Choice component are changed, they must also be changed in the “IF” field.

2 Likes

Would this work with roles enabled? What if one of the roles allows for every row, does this still work?

Hi, no idea, I’ve never used “row enabled”. Nevertheless, I’m not sure that there is an impact since at the end of the day it’s only a “group by” of an inline list.
ex. “Client” column has B2C, B2B entries → it groups the results of the inline list by B2B and B2C.

1 Like