Power Community

Power Community

Data in collections not appearing in Power Apps

Data in collections not appearing in Power Apps Microsoft Office 365

Have you ever found that data in collections not appearing in Power Apps? Are you displaying data in collections from a data source while you haven’t used this data source directly in your UI controls?

Explicit column selection

If you have found that your galleries aren’t loading data then you might have fallen for the issues related to the Explicit column selection feature.

Data in collections not appearing in Power Apps - Explicit column selection

So what does this feature do?

When you load your data sources in Poweer apps you might expect that all this data gets loaded. When you read data sources that only contain real data then this might be ok, but just imagine for one moment a data source like Dataverse. how many of those internal GUID fields can you have?

All those fields put your app under pressure, hence Microsoft decided to only load the fields that are actually used. This is a good idea!

When things go wrong!

In my app on start code I could for example use my data source files, and then filter the files by a certain location. This would be something like this:

ClearCollect(colVisibleFiles, Sort(Filter(Files, Path = varCurrentLocationInLibrary), IsFolder,Descending));

Now when I use the colVisibleFiles collection to display my files in a gallery I will actually see that the number of records in my gallery matches the number of records in my collection however, the data for the columns will not be displayed.

So how do we solve this?

We will have to use the ShowColumns function.

Something like the following lines will now make the columns explicitly used and therefore when I use the colVisibleFiles my fields will appear.

ClearCollect(colVisibleFiles, Sort(Filter(Files, Path = varCurrentLocationInLibrary), IsFolder,Descending));
ShowColumns(colVisibleFiles, "shp_filenamewithextension", "hyb_modified","modifiedby","hyb_location", "hyb_id", "hyb_fullpath");

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Enable Early Access Wave 1 2023 | Power Platform

Like every 6 months, enabling Early Access is one of the best things to look forward to as Microsoft...

More Articles Like This

- Advertisement -spot_img