Request help using GROUP

I am having great difficulty applying GROUP to a list and I shall appreciate any help on the matter.

I have a list of Purchases. One of the fields in the list is Category. My requirement is to group the list of purchases by category. The desired result is as in the image below.

I have used the Repeat By field in the list to add the GROUP statement, but nothing I have done works. I will be grateful for any guidance in building the GROUP statement.

Hi! In the 3rd argument for GROUP, key is a reference to the grouping value, in your case category, and items are the objects that match this key.

To get a grouping like [{category: "Lacteos", purchases: [{name: Yogurt Griego}]}, {category: "Carnes y Pescado", purchases: [{name: Oro del Titicaca}, {name: Rico pollo muslitos}]}, ...], you’ll use:

GROUP(purchases, item.category, {category: key, purchases: items})

A similar example can be found in the documentation for GROUP.

Thank you very much for your help

Adolfo

1 Like