Setting DefaultSelectedItems in a Combo Box shows multiple items selected if the label (values) are identical irrespective of these having different Ids.
Example: In my list options I have three items as follows:
ID Value
I initiate a variable to hold back the selection values of this Combo Box as varSelectedRegions. Based on other drop down values, I have the varSelectedRegions as {{EUCAN, 1}, {EEMEA, 2}} i.e. two items saved in the variable as selection.
I use the following formula in DefaultSelectedItems to show selected items in the Combo Box:
ForAll(varSelectedRegions, {Value: Value, Id: Id })
The items are displayed as selected in the Combo Box but not only #1 and #2 - #3 as well as it has same label as one of the selections I've set. Though when I save this item in the list, column values are selected correctly as #1 and #2.
Is there something I'm doing wrong here or this is a defect in displaying the selected items in the Combo Box which does not take Id in account?
Actually what you are seeing is related more to the search part - and I would actually consider it a bit of a design flaw/bug.
The reality is, your selected items are correct and only address the ID 1 and ID 2. ID 3 is not really selected, it just appears that way - I believe because of the way that the control displays and highlights.
The only real way around it would be to have unique items in the combobox. Which is really what you want. Because, from a user standpoint, if you see a list of items that have the same names...which one would you pick? How would I know that the first one is ID 1 and the last one is ID 3?
I hope this is helpful for you.
@RandyHayes : Correct; completely agree with your logic. In actual scenario having two items with same title will not be a reasonable implementation. In fact this defect is also discovered due to a defect in my implementation. I already fixed my defect and dont have any duplicate title items anymore...
Yes, the more that I thought about it after I replied...the more I realized it would definitely not be something you would want.
Like a list of colors and two "Red"s listed....then telling the user they picked the wrong "Red". Not so good.
Anyway, glad you got it sorted out.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
253 | |
235 | |
82 | |
36 | |
27 |
User | Count |
---|---|
313 | |
265 | |
120 | |
68 | |
44 |