Power Apps – Remove choice in Combo Box once selected
3 steps
Introduction:
In this blueprint, we will discover how to remove items in the list of choices of a combo box once selected by the user.
By enabling this feature, you should use a collection as the Items property of the combo box.
Proceed to the step-by-step instructions below to create a demo of this concept.
Take note that this does not work on the dropdown control.
Step 1:
Insert a button named Button1. Change the following properties:
Text property
"Collect"
OnSelect property
ClearCollect(collChoices,Table(
{Title: "Choice 1",ShowInDropdown: true},
{Title: "Choice 2",ShowInDropdown: true},
{Title: "Choice 3",ShowInDropdown: true},
{Title: "Choice 4",ShowInDropdown: true},
{Title: "Choice 5",ShowInDropdown: true},
{Title: "Choice 6",ShowInDropdown: true},
{Title: "Choice 7",ShowInDropdown: true},
{Title: "Choice 8",ShowInDropdown: true}
))
Step 2:
Click Button1 on Play mode to set the collection.
Step 3:
Insert a combo box named ComboBox1. Change the following properties:
Items property
Filter(collChoices,ShowInDropdown)
OnChange property
ForAll(Filter(collChoices,ShowInDropdown=false),
Patch(collChoices,ThisRecord,{ShowInDropdown:true})
)
;
ForAll(Self.SelectedItems As CurrentItem,
Patch(collChoices,LookUp(collChoices,Title=CurrentItem.Title),{ShowInDropdown:false})
)
Conclusion:
To test, select items from the combo box. You will notice that the item selected gets removed from the list of choices. This also works when you disable the multiple selection property.
Did this article help? Let us know how we can improve. Send us a message by clicking the “Contact Us” button below.
Article last updated on Mar 26, 2024
Need expert guidance on Power Apps?