I often forget the formula to display a SharePoint choice column in a Power Apps combo box, so I’m writing this note as a reference.
What I Want to Achieve
When you have a choice column in your SharePoint list like the one shown below,

this is how you can display those choices in a combo box.

Using the Choices Function
First, add the target SharePoint list as a data source in your app.

Set the Items property of the combo box to the following Choices function.

Choices([@SharePointListName].ColumnName)
// If the list name is "Sample" and the column name is "ChoiceColumn"
Choices([@Sample].ChoiceColumn)
Now, the SharePoint choice values are displayed in the combo box.

The same approach also works for drop-down controls.

Bonus 1: Using It for Gallery Filtering (Search)
If you want to use it as a filter for a gallery, set the Items property of the gallery with the following Filter formula and compare using the Value property as a string.

Filter([@SharePointListName], ChoiceColumnName.Value = ComboBoxName.Selected.Value)
// Example
Filter(Sample, ChoiceColumn.Value = ComboBox1.Selected.Value)
If you want to display all items when nothing is selected in the combo box, use the following formula:

Filter([@SharePointListName], IsBlank(ComboBoxName.Selected) || ChoiceColumnName.Value = ComboBoxName.Selected.Value)
// Example
Filter(Sample, IsBlank(ComboBox1.Selected) || ChoiceColumn.Value = ComboBox1.Selected.Value)
Bonus 2: You Can Check the Formula in the Edit Form
You can check this formula by displaying the relevant data source in an edit form, but if you remember it, you can write it quickly anytime.

Related Articles
コメント