Categories: Microsoft Power Apps

Power Apps Components and collections

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.

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

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.

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!

Share
Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

Recent Posts

Create Distinct filters for Power Apps galleries

So you add a gallery to your app in Power Apps and you want to…

2 days ago

Send push notifications to start your app in Power Apps

Have you ever wanted to send push notification to people's phones to run a Power…

7 days ago

Patch the Common Data Services with Power Apps

Using the patch Function to update records in the Common Data Services can be easy,…

1 week ago

Deploy Canvas Apps and Flows through solutions

When you deploy Canvas Apps and Flows in Power Apps and Power Automate you can…

2 weeks ago

Address Input in Power Apps

When you app needs users to input addresses, you can now use the Address input…

2 weeks ago

Just 3 clicks to disable an action in Power Automate

Have you ever wanted to disable an action in your Power Automate flow? It is…

3 weeks ago
%%footer%%