Using :group by – new advanced Bubble article

Hey guys,

Having had some questions in coaching sessions about the Group by feature, I decided to write an article about it. While the feature is fairly straightforward on its own, it does cause some confusion as to what exactly it’s used for. Hopefully this article can clear up some misunderstandings.

Enjoy, and as always I welcome feedback!

10 Likes

Thank you!

1 Like

Thanks @petter for putting this article together and sharing.

I had realised that is how grouping works, but what is the solution if we need grouping in the way that you have told it doesn’t work?

So to continue your example if I want to build a table that shows nested repeating groups in it like I want to see the clients in different cities grouped by their cities. So basically I would have Cities as the row labels and then within each city, there would be another repeating group showing clients of those cities. I do not want to do the aggregation and calculation, I just want to show them like that.

Is there a way to do that using something like “group by” which would be faster or we have to resort to having to create multiple nested repeating groups?

1 Like

Hi @mghatiya

In this case you’ll most likely have to create nested repeating groups. If your UX allows for it, you may want to make them expandable, so as to not load and render all rows at once but let the User decide when to expand each list of Clients.

You can also consider using an elementer like List Shifter to pre-load the list one each city row.

I’m just getting started with trying to do this, but I’m not getting the “grouping” coming up in “type of content” as an option…

@debbie, you are experiencing a bug with the new expression composer… turn it off and the grouping functionality will work as expected.

Hi Mike - thank you for the quick reply, that fixed it!

1 Like

recently I found that group by mehod ignore privacy rule, so it is not secure to use

Very doubtful but why don’t you send a screenshot of the following and we can check for you:

  • your privacy rule for that data type
  • the relevant user data that’s referenced in the privacy rule
  • the group by search in the expression composer

It might ignore privacy rules in the calculation of an aggregation (I don’t know, but it’s a possibility) but it will never allow you to return data from individual things that you shouldn’t have access to.

This is an easy example.
The privacy is for loing user, and I am logout user.

and the 2nd picture is the repeating group (type = grouping_test table) and add :grouping by .

Then, you can see the hidden column on preview.

スクリーンショット 2023-11-10 16.16.38

1 Like

@georgecollier
If I uncheck the “Find this in search” on the editor to Everyone else user, the repeating group returns nothing, but like in my case, the clumn of “name” can be seen to everyone

1 Like

Ooh, well this is curious. I’m assuming when Find this in searches isn’t checked it returns no data for logged out users.

Looks like this was right. It’s not in the manual :thinking:

Yeah, if I uncheck, logout user cannot see that but if I check as searchable, but not visible the column, logout user can view the column value…

This can be serious data exposing

Sorry if this isn’t the answer you’re looking for, but can’t you just add the relevant search constraints (ones that match the privacy rule that you want to work?).

It would be great if Group By could have the :cache-aggregation: with the cached count instead of only the count.