working with List of Maps

Hi!

I'm having trouble trying to modify this list of maps (which I get from a!queryRecordType with an aggregation).

local!Grades: {
a!map(Group: "A", Excellent: 0, Good: 0, Regular: 0),
a!map(Group: "A", Excellent: 2, Good: 0, Regular: 0),
a!map(Group: "B", Excellent: 0, Good: 0, Regular: 2),
a!map(Group: "B", Excellent: 0, Good: 2, Regular: 0),
a!map(Group: "C", Excellent: 0, Good: 2, Regular: 0),
},

The aggregation does not allow me to get each Group in only 1 row, because I need to "count" the grades by category (Excellent, Good, Regular)

I would like to display that result in a read-only grid and am trying to prepare the data before displaying it there (as I read in some other suggestions).

The result I am trying to obtain is this:

local!Grades: {
a!map(Group: "A", Excellent: 2, Good: 0, Regular: 0),
a!map(Group: "B", Excellent: 0, Good: 2, Regular: 2),
a!map(Group: "C", Excellent: 0, Good: 2, Regular: 0),
},

In other words, I want to match each row of the grid to each group, and the columns will be: "Excellent", "Good", "Regular".

I tried using 2 nested foreach... but it doesn't work.

Please, help me with some ideas!

Thank you in advance!

  Discussion posts and replies are publicly visible