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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,043)