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

ComboBox DefaultSelectedItems From Option Set

How does one set the default selected item in a combo box when the items are set to an Option Set? 

 

Suppose I have a Car entity.  A field of the Car entity is Color.  Color is an option set ("Red, Blue, Yellow").  In the canvas app I have a combo box that displays the Color option set.  I'd like the combo box to default to the selected Color if it has already been set in the Car entity at some point earlier. 

 

I can't figure this one out.  I'm still new to Power Apps but this sure seems like it should be pretty simple and straightforward but I'm drawing a blank.

 

Thanks,

Dan

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User
Super User

Or taking your example. If the Items property of the Combo Box is set to:

Choices(Car.Color)

Say you want to set the DefaultSelectItems property of this combo box to "Blue", you can use:

[Color.Blue]

Or say there is a car record, CarA and you want to use its color as the DefaultSelectedItems, you can use:

[CarA.Color]

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

 

View solution in original post

4 REPLIES 4
PowerAddict
Super User
Super User

A combo box expects a table in the DefaulSelectedItems field. For example, if my Items property is ["Red", "Blue", "Orange"], then my DefaultSelectedItems property cannot be "Red", it has to be ["Red"] or ["Red", "Blue"]. 

 

Does that help?

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

PowerAddict
Super User
Super User

Or taking your example. If the Items property of the Combo Box is set to:

Choices(Car.Color)

Say you want to set the DefaultSelectItems property of this combo box to "Blue", you can use:

[Color.Blue]

Or say there is a car record, CarA and you want to use its color as the DefaultSelectedItems, you can use:

[CarA.Color]

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

 

simondoy
Advocate I
Advocate I

I found this whilst looking for a solution with Dataverse for Teams. This approach does not work with Dataverses OptionSets.

To set DefaultSelectedItems do the following:

Say you have an OptionSet called CarColour and the Items property is set to Choices(Car.Colour)

Set DefaultSelectedItems using Filter(Choices(Car.Colour), Value = ThisItem.Colour)

 

Where ThisItem is your record.

 

Hope that helps someone.

 

 

You just saved my life!! I've been working on this for hours and nothing else worked! Thank you so much

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,856)