The choices function returns a table of elements that we can choose from. Note the return “table,” meaning that we can use other functions like the Filter function, for example, to parse the data before showing it to the user.

The choices will fetch from the data source (for now SharePoint and Microsoft Dataverse) the table in the reference. For a detailed example of how to use this and how it connects to SharePoint, please check my article on this.

Usage

It follows a simple pattern.

  1. Reference to the column containing the data.

Example:

Choices(Project.Status)

will return 

Delayed
On Hold
On Time
Finished

Notice that I’m representing the values as a list, but the Choices function will return a table. I’m doing so to be easier to understand but keep this in mind when using the Choices function.

The most common usage for the Choices Function is a Dropdown. By fetching the results from your data source, you can always be sure that you’re fetching the correct information and the data saved matches the destination.

Another use case is fetching from SharePoint Lists, where the column is a “Choice” column. The data is part of the column’s metadata, but you can fetch it and provide it to your user.

Here’s the List:

And here’s how to fetch the data in your Power App:

Most people forget about this, but it’s instrumental if you want to keep a single source of truth for your data.

Limitations

Choices aren’t delegable. It can be an issue since you have more than 500 (or 2000 if you configure it that way). If you have more than this, Microsoft recommends to “add the foreign entity as a data source, and use it directly.”

Another limitation is that Choices are only available for SharePoint and Microsoft Dataverse. Plan accordingly if your data source is somewhere else.

Finally, the column references need to be direct to the data source. You can’t have it from a variable or control, for example. For this reason, you should also not use quotes in the function. Provide a direct reference to the table for it to work.

Recommendations:

  1. Please note that the Choices function will return all columns of the reference table. If you’re using a dropdown, for example, you can limit to only the column that will populate the data.
  2. Don’t nest it. There’s no real reason to do it, but if you find yourself in a situation where you have nested Choices functions in a formula, you should review it and make everything more straightforward.
  3. Don’t ignore the delegation warning. Your app won’t break, but your users won’t see all the data, even if it exists in the data source.

Sources:

 Choices functions in Power Apps 

Back to the Power Apps Function Reference

Photo by Victoriano Izquierdo on Unsplash

Manuel Gomes

I'm a Project Manager with experience in large projects and companies. I've worked in the past for companies like Bayer, Sybase (now SAP) and I'm currently working for Pestana Hotel Group.

View all posts by Manuel Gomes →

Leave a Reply

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

%d bloggers like this: