I have a list of trips from users. Each trip has a location, date range, and user.
I’d like to group the trips by city, and display a list of cities, each with a list of trips under each city:
- Portland
-
- Brenner: August 1st - August 7th
-
- Logan: August 2nd - August 8th
- Seattle
-
- Anna: August 1st - August 7th
-
- Don: August 8 - August 10th
I first make a RG of Trips and :group by
city. This returns a Grouping.
The :group by docs say:
The output of doing a “:group by” operation on a list is a new list.
My first question: Why does this return a list of Groupings, and force me to make the type of content a Grouping, instead of a Trip?
For each cell, I would think the value of the current cell would be a list of Trips, not Groupings.
I put another RG in a single cell of the first RG, and when I go to access the Current Cell’s item, it’s a Grouping, not a list Trips, or even a list of Groupings. Why is it returning a single Grouping instead of a list of Groupings? And even then, I can only access the field by which I did the :group by
from the Grouping, as opposed to all the fields I’d be able to access if it was returning a Trip?
What am I doing wrong?
Note: “city and state” is the official name of the field that I’m grouping by, I referred to it as just “city” for simplicity’s sake