GROUP BY ... but how to get the data's values?

Hi all,

I’m using the :group by function to group all records with “datum range” and display it to a repeating group:

It works fine but how to access the values like “Datum Ende” or “Unique Id” (??!!):

Only the grouping by param is available. I haven’t used the aggregate function because i don’t use it in this scenario. I just want to return a field from the grouped by first item, the field: “Von Tag-Typen”:

Here’s the repeating group that works fine, but I want to show then tag-typ :

Any ideas?

best,
jupxi

Did you try clicking + Add a New Grouping and selecting the “Von Tag-Type” field? If you’re able to do that, you should be able to return the data from that field for the grouping.

1 Like

Interesting… it works, but how to get another field? if I want to add another field (add to group by command) and nothing happens:

(empty result:)

any ideas?

I haven’t read through your post thoroughly, so I might be wrong.

But often people who come with traditional coding background (or SQL) expect group by to work differently. In Bubble group by is just to do aggregation (count, sum etc.) by certain groupings and not really to group results by a field the way it works in SQL.

Is that a cause of confusion here?

correct! I don’t understand this in bubble.
I just want to get a value from the result (first item).
do you need any further information? (see my screenshot. I want to get the “Datum Start” for example.)

Best,
jupxi

If you want to retrieve actual items, then group by is not the thing for you. Group by in Bubble is for aggregated results and counts.

Solution here depends on your use-case:

Very likely what you need is filtering by the criteria (datum range) and then take the first item. So basically do search for and put datum range constraint in the constraints.

In some other use-cases you might need one of the following:

  • Instead of grouping by, sort by the field you are grouping by and then take the first item.
  • Or you may need to create a separate repeating group for the field you are grouping by and then in each element of the repeating group you query for the data matching that particular cell and then pick first item.
1 Like