web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / data for collection in...
Power Apps
Unanswered

data for collection in custom component

(0) ShareShare
ReportReport
Posted on by 4

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 

I have the same question (0)
  • lawrence_sproul Profile Picture
    4 on at

    I know it is a terrible solution, but I seem to have gotten ii working by putting each of the above three collections into a separate hidden Gallery.... eg GaleryOne.Items = AddColumns(Group_By( ....

    I will try to get rid of one hidden gallery next.

  • lawrence_sproul Profile Picture
    4 on at

    colTwo does not add value as there are more efficient ways to get this data in my component. 

    So ia ma only trying to get from colOne to colItems.

    I can now do this with only one hidden gallery.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard