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");
2 thoughts on “Data in collections not appearing in Power Apps”
Saddly, you’ll have to pay attention as ShowColumns / hideColumns … are not delagable.
I don’t think that it matters too much. If you want the columns to be selected while you query, you would most likely disable the feature.