Refactoring your Power fx code to support Explicit Column Selection

Every had that feeling your going mad, as the Canvas app worked yesterday worked fine but today most of the data is missing when using the Dataverse as a data source?

One recent update to Power Apps did just that, the culprit, a preview feature that MS enabled by default, if you weren’t aware of the change, because the Power Platform teams comms are just well non existent on the updates and fixes being released, is Explicit Column Selection.

What this means if your filters and collections don’t explicitly request the column you will no longer get it in the response.

You can turn this setting off under Files –> Settings–>Upcoming Features

This is actually a really good feature and I recommend you leave it on and re-factor your code.

A standard pattern to create a collection is to filter a data source, such as:

ClearCollect(
    Collection,
    Filter(
        DataSource,
        Field = Value
    )
);

This would return all fields from the data source, to refactor this, we need to use ShowColumns in SQL we would use SELECT, they do the same thing…

For example if we want to show, Name, Description, StartDate in a gallery the code would be as follows to build our collection.

ClearCollect(
    Collection,
    ShowColumns(
        Filter(
            DataSource,
            Field = Value
        ),
        "Name",
        "Description",
        "StartDate"
    )
);

What’s your Reaction?
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

pen

Leave a Reply

Your email address will not be published.

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