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.
It follows a simple pattern.
- Reference to the column containing the data.
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.
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.
- 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.
- 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.
- 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.
Choices functions in Power Apps
Back to the Power Apps Function Reference
Photo by Victoriano Izquierdo on Unsplash