Hello PowerApps community,
New to PowerApps here, I have 2 Comboboxes with identical items in a blank canvass screen. I would like to give user an error message if the selection in combobox2 is the same selection in combobox1.
Any help would be appreciated.
Solved! Go to Solution.
hi @Anonymous we have multiple people on this item for you.
in my example you replace the following - highlighted in orange
Please make sure that you select the right column in the Fields
Consider the following:
Perform the following
This will indicate a item selected in combobox 2 which exists in combobox1
Preventing the scenario completely consider
R
hi @Anonymous
Consider the following:
Perform the following
This will indicate a item selected in combobox 2 which exists in combobox1
Preventing the scenario completely consider
Both scenario assume you will allow multiselect
Hope this helps,
R
Are the ComboBoxes getting their items from a data source like a collection or did you manually type them into the items property?
Hi @Anonymous ,
Try like this.
On change property of combobox 1, clear and collect selected items.
ClearCollect(test1,ComboBox1.SelectedItems.Value) [ Create a collection Test1.]
repeat the same for Combo box 2.
ClearCollect(test2,ComboBox2.SelectedItems.Value)
Below you can have a validation Label :-
Concat(ForAll(test2, If(CountRows(Filter(test1,Value = ThisRecord.Value))>0,Concatenate(ThisRecord.Value,":-Duplicate Selected",Char(10)),Concatenate(ThisRecord.Value,":-Unique Selected",Char(10)))),Value)
Please give me a Thumbs up if I answered your question and mark it as a solution to help others.
Thanks
Abhi
The combobox items are coming from an excel data source, and I'm trying to avoid the user from making a duplicate selection.
To build on the answer given by @rubin_boer , if you have manually typed your choices into the items property you can do the same thing like this:
Example: Combbox1 Items ["Red", "Pink", "Blue", "Yellow"]
Combobox2 would be this:
Filter(["Red", "Pink", "Blue", "Yellow"], !(Value in ComboBox2.Selected.Value))
This will remove the selected item from the available choices in the second combo box
hi @Anonymous we have multiple people on this item for you.
in my example you replace the following - highlighted in orange
Please make sure that you select the right column in the Fields
Consider the following:
Perform the following
This will indicate a item selected in combobox 2 which exists in combobox1
Preventing the scenario completely consider
R
the problem facing while using this solution
If the user selected some people in first combo box . It will be removed from the second combo box
But If the user again select the first combo box . And then when the user return the second combo box . If the
selects any option which was already selected . Again it will be counted as selected
User | Count |
---|---|
251 | |
102 | |
94 | |
47 | |
37 |