I am converting a screen that I developed into a custom control, however, I can't get the right data into the gallery.
I have a custom property called Items that allows me to pass a table to the control, which then does some grouping of the data for use in the gallery.
I have tried many things and the closest that I have gotten is by using three successive collections. This works when I build on a screen, but there is nowhere to put the code for making the collections in my custom control. I have tried OnReset, but it doesn't present a default set of data unless the Reset is triggered.
Can someone help me convert the following so I can put it directly in the Items property of a gallery?
ClearCollect(colOne,
AddColumns(
GroupBy(
CustomControl.Items,
"Group",
"SubGroups"
),
"Group Total",
Sum(
SubGroups,
Value
),
"Subgroup Count",
CountRows(SubGroups)
)
);
ClearCollect(colTwo,
AddColumns(colOne,
"Group Count",
CountRows(colOne)
)
);
ClearCollect(colItems,
With(
{
records: colTwo
},
ForAll(
Sequence(CountRows(records)),
Patch(
Last(
FirstN(
records,
Value
)
),
{rowNumber: Value}
)
)
)
)
the source table has columns for Group, Subgroup, and Value