How to Display SharePoint Choice Column Values in a Power Apps Combo Box (with Gallery Filtering & Search)

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,
SharePoint list with a choice column example
this is how you can display those choices in a combo box.
Combo box displaying choice values

Using the Choices Function

First, add the target SharePoint list as a data source in your app.
Add SharePoint list as data source in Power Apps
Set the Items property of the combo box to the following Choices function.
Set Items property to 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.
SharePoint choice values in Power Apps combo box
The same approach also works for drop-down controls.
SharePoint choice values in Power Apps dropdown

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.
Gallery filter formula using SharePoint choice values
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:
Formula to display all items when no combo box selection
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.
Check formula in edit form

Related Articles

コメント

Copied title and URL