Table Of Items

One of the known limitations with Power Apps Components is that collections are not supported.

The above link clearly states that

  • Power Apps doesn’t support collections in components.

Does this mean that you can’t use collections in your components?

Not really!

Power Apps Components Limitations

However when you create yourself a collection/Table parameter and expect to use this collection inside your component then you will discover the limitation quite quickly.

Table Of Items in Power Apps Components

So how can we use data in a collection then?

Generating a collection

As an example I’m going to use the GetAdminApps function from the PowerAppsforAdmins connector.

The function takes the name of an environment as a parameter. This parameter can be supplied as a component parameter.

This now means that a gallery’s items can be collected like this:

PowerAppsforAdmins.GetAdminApps(cmpListItems.SelectedEnvironment).value

Even though the Component will show you the following error, inside an app the component will work

Collecting Environment data

In my app I can now see the results and as I select different environments I will see different results coming back. In the example below an environment holding 2 apps results in 2 records being returned.

Apps displayed in app

That is a great first step, however I might want to reuse the component.

You could now for example inside your app specify a collection. Then use the filter function inside the Component to filter by parameters supplied by component properties.

The important factor is to keep the datasource for the component the same, however parameters can be different. It is important to understand that at design time the data model may need to be known for Power Apps to be able to validate the app. Hence varying the datasource is not going to work.

To make component development easier you might want to temporarily set the items in your gallery to specific data.

In my previous example instead of using the following expression:

PowerAppsforAdmins.GetAdminApps(cmpListItems.SelectedEnvironment).value

I initially used something like the below:

PowerAppsforAdmins.GetAdminApps("39ffdc6a6-1dd8-4c13-84a9-1847f555ae47").value

This way my Power Apps component showed be actual data. Once I was happy with the component all I had to do was replace the hard coded environment guid with the component property name and ignore the error warning in the component.

Other Components posts

How to size Power Apps components dynamically in 1 easy step!

 

 

 

 

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as a Principal Architect at HybrIT Services Ltd. You can contact me using contact@sharepains.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue Reading

%d bloggers like this: