Showing results for 
Search instead for 
Did you mean: 
Super User
Super User

COMPONENTS: Create a Collection in a Component?



I want to create a reusable tracking component. Click a button, collect a timestamp, click the button again, collect another timestamp, etc.


I don't know how to approach this problem since "...PowerApps doesn't support collections in components".


Is there a way to:

  • Reuse the component across different app screens
  • Collect these timestamps from each screen/component to the same Collection in the App

Would I use a Custom Output Property here and variables?


@yashag2255, @RandyHayes 

Level: Powered On

Re: COMPONENTS: Create a Collection in a Component?

I created a Component and inside that added a button. I wrote "Collect(TimeStamp,Now())" on the OnSelect method of the button. Also I used the components in multiple screen and it is working. I also exported the component and imported in another App and it is working. May be you try using collect command in your component.

Community Support Team
Community Support Team

Re: COMPONENTS: Create a Collection in a Component?

Hi @seadude ,

Do you want to set a control's OnSelect inside component to Collect collection?

I've made a similar test and found that it is feasible.

Please note that component is an experimental control, so its function is improving.

Once in a while, its function will update. The doc that you listed wrote six months ago, some new functions may not update.


Here's my test for your reference:

1)Create a component, set a button 's OnSelect:



2)Insert this component in screen1 and screen28141.PNG




3)Set a gallery's Items to this collection: a

4)Run this app

If I click the button in screen1 and click the button is screen2, the collection will update successfully.8143.PNG



Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dual Super User
Dual Super User

Re: COMPONENTS: Create a Collection in a Component?

Hey @seadude 


You can try to use the below expression on the OnSelect property of the button inside the component. I carried a test on my side and this works fine. Please refer to below screenshots:
Expression Used:
Collect(MyCollection,{Title:Concatenate("Test",Text(CountRows(MyCollection)+1)),TimeStamp: Now()})
The highlighted part collects the timestamp.
When imported on multiple screens, this will point to the same collection.p.png




Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources


Power Apps Super User Class of 2020

Check it out!


New Badges

Check it out!


Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,870)