cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to use collection in component?

I wanted to create a component to collect list of email addresses. Where can I define the collection?

On clicking Add, I wanted to add the email to collection and show it in a gallery control inside the component itself, as shown below diagram.

 

Also,I wanted to return the list of emails from the component

 

1.png

 

 

9 REPLIES 9
poweractivate
Most Valuable Professional
Most Valuable Professional

@pcakhilnadh 

Try this

poweractivate_1-1634729517021.png

 

1. Under Properties (of the Component) click on New custom property

2. Click Dropdown for Data type

3. Select "Table" from dropdown for an equivalent of Collection.

4. Click Create

 

 

Check if it helps.

 

If you are unsure if a Table is same thing is Collection - I think they essentially are, actually.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-tables#behavioral-formulas

Notice in this page, the way Table is talked about is same as Collection, for example.

 

Check if above helps.

 

I do think there may be one difference.

Table, for each Record I think must have same Field names across all Records.

If they do not have the same ones, then they are Collection that is not a Table.

Otherwise, they are Table, which also is, I believe, still a Collection too.

I believe this might be only main difference. 

Other than this I think they are almost the same.

 

@poweractivate 

Could you tell how to add Value to this table ?  The purpose of using collection is to add an item to it and display in gallery.  How to perform this action is unclear from your explanation

@pcakhilnadh 

 

poweractivate_0-1634731870870.png

1. Click the text Custom property 1

2. The stuff in the curly braces are the Fields- add or remove as you please

 

 

Check if it helps.

 

Please note this is the property of Component which is intended maybe for something else than what you are asking.

 

Instead if you want to have just regular Collection inside Component, maybe just use ClearCollect instead from scope of Component in the initialization of the Component - maybe from OnReset property of Component for example.

poweractivate_1-1634731969330.png

 

@poweractivate  

 

In the example shown above, you are adding items to the table while initializing it. 

Im looking for adding a row on button click dynamically. Basically I need to collect email address from the user and add to this table and show in the gallery. This is still unclear from your explanation.

 

AFAIK, "Component in the initialization of the Component - maybe from OnReset property of Component for example."   this is not supported in powerapp. 

I'm looking for alternative ways to acheive the earlier said requirement.

@pcakhilnadh 

 

According to here Collections in Components are not supported, so be careful with it:

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-component#known-limitations

 

Known limitations
  • You can't save data sources, forms, and data tables with components.
  • Collections in components aren't supported.
  • You can't insert a component into a gallery or a form.
  • A master instance of a component is a local master and scoped to the app. If you change a master instance, only copies of the component within the app will reflect the change. Copies in other apps will remain the same unless you import the component library again. All master instances in those apps will be automatically detected and updated.
  • You can't package media files when you import a component.
  • Components don't support the UpdateContext function, but you can create and update variables in a component by using the Set function. The scope of these variables is limited to the component, but you can access them from outside the component through custom output properties.


 

Try it without a Component first. After that, try to recreate same functionality in Component, then see if you can somehow use the Table Input or Output Property to use it or access it from outside and/or to change it from outside if needed in a Component kind of way. It may be possible to still do this despite Collections not being supported (you can instead use "Table" as the data type of the Property and just put it there and pretend it is Collection) - but it may be easiest to start by implementing your functionality in an example App with no Component - then try it with a Component after that.

I've read this article and I also know how to implement it without components. The sole purpose of posting this query is to look for answers using components only. I wanted to add a new row to the table not while initializing the table input property.  Is there any solution to this issue? I would be grateful if you can suggest it.

@pcakhilnadh 

 

Right now I'm not sure of it, I'd have to check on it further. In meantime if someone else here knows it I'd be curious as well. 

KASCHN
Resolver II
Resolver II

I am having issues with this as well. My component has a gallery. Using the OnReset property I created two collections which I then use to populate the gallery and then manipulate the output. My gallery has text input fields and combo boxes. My intention is to update one of my collections with the OnChange property of the input controls with an UpdateIf(collection2, id = ThisItem.id, { prop: something})

 

It works sometime but when I refresh both the component library or my canvas app, I get 2 errors foreach control

  1. Name isn't valid. '{0}' isn't recognized textcontrol1
  2. The function 'UpdateIf' has some invalid arguments. [its the reference to the collection that I created in OnReset that is causing the issue.]

I thought  maybe if I reset the component it would resolve the error but that does not. I am not sure how to use collections in this situation.

 

So, I think I found a resolution to this issue. You can create your collections in the OnReset which runs when the component is loaded on a screen or if you use the method Reset(myComponent). To resolve the errors, I added a "fake" icon button with visible = false and added the same ClearCollect statement i used in the OnReset to the OnSelect property.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (781)