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.
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");
Continue Reading Pieter Veenstra’s Article on their blog
Data in collections not appearing in Power Apps
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? 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.
Blog Syndicated with Pieter Veenstra’s Permission
More About This Author
Array
- Modern Workplace26 March 2024Receive the available storage within your SharePoint Online tenant
- Modern Workplace20 March 2024Options for Documenting Your Power Apps: Comments, Code, and Controls
- Modern Workplace18 March 20242 ways to duplicate SharePoint Lists to support your Power Apps
- Modern Workplace14 March 2024Update a Hyperlink Column in SharePoint with Power Automate