Suppose we have an arbitrary list of Aircraft, and each Aircraft has an Aircraft Type (both are data types).
Aircraft are associated with a company, but not Aircraft Types. So, let’s suppose we want to show the list of aircraft types a company has.
We could use Do a search for Aircraft (that belong to this company):each item's Aircraft Type
, possibly with :unique elements
at the end.
This is, I suppose, the ‘standard’ pattern you might use (to re-emphasise, this is an imperfect, arbitrary example).
However, I recommend considering using:group by
. I think group by might be the most underappreciated Bubble operator.
Do a search for Aircraft:group by Aircraft Type:each grouping's Aircraft Type
returns the same output, and is cheaper because it runs as an aggregate search.
With the each item approach, we have to return each item in both the Aircraft and Aircraft Type tables. With the grouping (aggregate) approach, we don’t need to return each Aircraft which reduces the number of things returned.
It also runs a little faster, if you compare both forms of the expression on the page and give it a refresh.
So, if you’re curious, give :group by
some love if you’re ever looking for :each item’s Thing.