cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PhilD
Kudo Kingpin
Kudo Kingpin

Combo box "Selected" not really selected until a person picks it

This issue has been plaguing me for months in different apps.

 

Essentially, it is always some variation of this example...

 

  • Combobox1 Items set to return items from SP list
  • Combobox1 DefaultSelectedItems set to a specific choice from the list
  • Gallery is set to Combobox1.Selected
  • Gallery returns not items until the user actually manually chooses one of the values from ComboBox1 (even the item originally showing works if the user manually chooses it)

I can easily confirm this behavior by putting a label next to the combobox set to display ComboBox1.Selected. The DefaultSelectedItems shows in the combobox yet the label set to display ComboBox1.Selected remains empty until a choice is made manually.

 

Why is this and is there any proper workaround?

27 REPLIES 27

I think my issue was that I was using a collection of the items (Sorted version of the CDS entity), in one part of the control, but the direct CDS entity in another.  After straightening everything out, it did, indeed, work as expected.  Thanks for your tips!

You're welcome.

Well now! Thank you for redirecting back to your solution. It made me take another look at it and realize that when I was copying in the code, the line break was adding an extra space. Removed the space, works like a charm! Thank you for this. This has been a thorn for several weeks! --> "; "

I have used ccauser's solution and I, at least, now have it showing the selection in the combo box while prior the combo box was empty though the selection had Patched into the list.  

Now, my problem is this: as soon as I choose "edit" in my gallery, the combo box changes and shows the first item in the list of choices in the combo box instead of the one that had been chosen.  

I don't have anything in the defaults field.  Following is what I have in my properties: 

Items

colLocations.ConcatenatedChapterName


DefaultSelectedItems

Filter(colLocations,ConcatenatedChapterName in Split(ThisItem.Chapter,";")).ConcatenatedChapterName

Any idea?  

ramanujama
Helper I
Helper I

It is really simple.
Example you have an Employee table with columns: Id, Name

Suppose you have created a Combobox for email and selected A, B, C and saved it in database. When you load the page or comes again, you want those items to be selected as default, use below formula:

DefaultSelectedItems = Filter(Employees, Name in Split(EmailList,","))

Note: EmailList is coming from database (previously saved value)

Above formula selects items in combobox as well.

How would this work to populate the combobox with the previously selected DisplayName from the Office365Users connector?

Here's what I've tried to simulate what you presented:

Filter(Office365Users.SearchUser(),DisplayName in Parent.Default)

I can see that Parent.Default has the value of what should be selected in the Combobox, but nothing displays as being selected.

imocean
Advocate I
Advocate I

Thank you so much @ccauser,  you saved my life! Well done! 

bmakan
New Member

I registered specially to post this here...

 

First of all, this is a horrible design - I'm a web developer so I think this counts for something. Horrible!

 

I have two tables - Children and Parent. Children parent has a "ParentID" column which references the Parent.ID (Lookup type).

I have a combo box which is supposed to hold items of parents so I can populate the foreign key into the new child. This was automatically created as a dropdown of "ID"s (numbers). User has no way to what he's selecting based on an ID. And DislayFIeld did nothing at all - kinda makes sense based on what the Items are set to by default.

 

The "Items" of the ComboBox were set to: "Choices([@'Children'].ParentID)". I tried to set the "DefaultSelectedItems" to various variations of LookUp, Filter, even { Value: MyID }. Nothing worked! This weird Formula creates some kind of Table with Id and Value columns. Not even { Id: MyID, Value: MyID } worked. I would expect something a little more sophisticated given I'm using a Lookup column type.

 

The trick is, you have to set the exact same format as the Items field is using. What finally worked for me was this:

LookUp(Choices([@'Children'].ParentID), Id = ParentID)

(I set ParentID in the OnVisible property of the form based on the currently logged user.)

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,557)