cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resolver I
Resolver I

readding the default combobox values on change

Hi All,

The default: 

{
DisplayName: Office365Users.UserProfile(Manager.email).DisplayName,
Claims: "i:0#.f|membership|" & Lower(Manager.email), 
Department: "", 
Email: Manager.email, 
JobTitle: "", 
Picture: ""
}

 
I have a combobox that for people data, I was able to add the default value (as above), but now I need to check on change if the person which is the default value is not in the SelectedItems if so then readd to the combo box. Anyone has any idea how I can do that, I tried with patch and with collect but it does not seem to work.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @RandyHayes,

I wasn't.

The collection was filled with the first item which is the person's Manager. But I fixed it by resetting the form from the OnSelect property in the gallery.

Thanks for taking the time.

View solution in original post

4 REPLIES 4
Super User III
Super User III

@rssilvaba 

Can you describe more about what you mean by "readd to the combo box"?

Also, you mention this is a combobox - The default property is pretty much meaningless on a Combobox.  The property you want to set on a combobox is the DefaultSelectedItems property.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Hi @RandyHayes, I had an issue with the card. The card default was only accepting a record, I had to re add it from the form to have a collection/table as default.

Funny thing is that I now realize that even the defaultSelectedItems is not working. The value only appear when I change the combobox items. Basically I was able to it with the following:
Set the defaultSelectedItems to _glb_colCc and OnChange to:

If(Not(LineManager.email in DataCardValue1.SelectedItems.Email), 
ClearCollect(_glb_colCc,{
DisplayName: LineManager.displayname,
Claims: "i:0#.f|membership|" & LineManager.email, 
Department: "", 
Email: LineManager.email, 
JobTitle: "", 
Picture: ""});
Collect(_glb_colCc,DataCardValue1.SelectedItems);
Reset(DataCardValue1);
)

 
Now I want to understand why the value only appears if I change the combobox, I even tried to reset it after setting the collection.

Super User III
Super User III

@rssilvaba 

Your value would only appear after you change because you are only setting your items in a collection which would be empty up until the point that you change the selection.

So, pre-populate the _glb_colCc collection with the items you want.  

However, you might want to reconsider your approach to this as you will eventually end up with a circular reference because you really DON'T want to reset the control as that will wipe out the selections that you 

 

If(
   !(LineManager.email in DataCardValue1.SelectedItems.Email), 

       ClearCollect(_glb_colCc, 
           DataCardValue1.SelectedItems, 
           {
              '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
              DisplayName: LineManager.email,
              Claims: "i:0#.f|membership|" & Lower(LineManager.email), 
              Department: "", 
              Email: LineManager.email, 
              JobTitle: "", 
              Picture: ""
           }
        )
)

Again, you will need to prepopulate the _glb_colCc collection somewhere, like OnVisible of screen.  Otherwise it will be empty until you actually change the combobox.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Hi @RandyHayes,

I wasn't.

The collection was filled with the first item which is the person's Manager. But I fixed it by resetting the form from the OnSelect property in the gallery.

Thanks for taking the time.

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (11,256)