web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combo box does not sho...
Power Apps
Answered

Combo box does not show default value from defaultselecteditems

(0) ShareShare
ReportReport
Posted on by 30

Hi,    Starting a new thread since I had closed my other question -

 

I have a combo box with drop down values coming from sharepoint list:

"hours: Values are "8" and "4"

 

I am setting the defaultselecteditems of the "hours" combobox to:

{Result: "4"}

 

However, when I launch the form, this is not defaulting to 4. 

Can you tell me why and how to fix it? Eventually, I want to add a conditional logic on the defaultselecteditems (set value based on another combo box) but this first step is not working, so I am stuck.

 

Thanks in advance,

Grace

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @grace3 

    What is the Items property of your combobox?

  • grace3 Profile Picture
    30 on at

    Since I have been stuck and troubleshooting this issue for a few days now, I have tried everything..

     

    For Items, it used to come from sharepoint list.

    But I then changed it to be hardcoded as:

    ["8", "4"]

     

    This is how it is currently. The drop down shows up fine if I manually select them.

     

    thank you!

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @grace3 

    So, when you use ["8", "4"] you are using a shortcut in PowerApps.  What it does is save you typing time and will create a table with a Value column.  That syntax is equivalent to: Table({Value: "8"}, {Value: "4"})  

    As such, your Items property is going to be a table with a Value column.

     

    To get DefaultSelectedItems (DSI) to match selections, the records MUST match.  

    You are providing a record with a Result column, not a Value...so it will not match!

     

    Your DSI Should be: {Value: "4"}  this will match the record of the items.

     

    Also keep in mind that a combobox should really only be used if you have a need for either searching or multiple selections in the control.  If you don't then I would stick with a Dropdown control as the only thing you need to do there is supply a text value to the Default property.  So, if your control was a Dropdown for example, you would only need to set your Default to "4".

    A combobox is more complex, and as such, you need to provide a matching record for matches to be made.

  • grace3 Profile Picture
    30 on at

    Here are the combinations I tried:

     

    Items: ["8", "4"]

    DSI : {Value: "4"}

    Does not work 

     

    Items:  Table({Value: "8"}, {Value: "4"}) 

    DSI : {Value: "4"} 

    Does not work 

     

    Tried adding a brand new dropdown box:

    Items: ["8", "4"]

    no DSI for dropdown boxes. Set Default as ["4"], it shows up on form's edit mode, but when I play it and then change it, and then go back to edit and play again, it no longer rests back to 4.

     

    Added if statement to the Default value of dropdown: 

    if (leave_type.Selected.Value = "Full day","8", "4") 

    This gives error.

     

    Thank you.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @grace3 

    Okay...let's review!

     

    Try 1:

    Items: ["8", "4"]

    DSI : {Value: "4"}

    Does not work 

    This SHOULD very well work.  The Items and the DSI record are identical.  This would match.  If this doesn't then there is something else going on.  (Comboboxes DO get confused sometimes and they need to be cut off the screen and then pasted back to "reset" them internally)

     

    Try 2:

    Items:  Table({Value: "8"}, {Value: "4"}) 

    DSI : {Value: "4"} 

    Does not work 

    This is actually 100% identical to the Try 1 above.  ["8", "4"] is the same as Table({Value: "8"}, {Value: "4"}) 

     

    Try 3:

    Tried adding a brand new dropdown box:

    Items: ["8", "4"]

    no DSI for dropdown boxes. Set Default as ["4"], it shows up on form's edit mode, but when I play it and then change it, and then go back to edit and play again, it no longer rests back to 4.

    Yes, dropdowns do not have selected Item(key there being the plurality...any time you see any property that ends in "s", it means it is a Table of records).  Dropdowns only have a Default property because you can only select one item.

    Keep in mind that you are dealing with Defaults.  Any Default in PowerApps provides the value for when a control is initialized or reset. That means If you change a dropdown control, it will retain that value until reset.

     

    Try 4:

    Added if statement to the Default value of dropdown: 

    if (leave_type.Selected.Value = "Full day","8", "4") 

    This gives error.

    This is a valid formula - so what is the error?

  • grace3 Profile Picture
    30 on at

    Thank you for validating that it should have worked!

    I will reset them. So you mean delete them from my form, and then re-add back, and then reset properties, right?

     

    For #4: The Default option of dropdown: if (leave_type.Selected.Value = "Full day", "8", "4") 

    There is a red underline,  "There is an error in this formula. Try revising the formula and running it again".

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @grace3 

    Really just start with cutting (ctrl-x) the combobox and then pasting (ctrl-v) it back in.  This *usually* will reset the control if it is in a "weird" state.

     

    As for the error...please hover over the red underlined error formula and see what the tool tip shows is the actual error.  If there is one part of that formula that is underlined with a thicker red underlined - aim for that part as that is where the error is occurring - see what the hover message is.

  • grace3 Profile Picture
    30 on at

    I deleted my drop downs completely and then re-added from sharepoint list. It did not work.

    Instead of using the play button, I published and launched the form, and it still does not work.

     

    For #4: The Default option of dropdown: if (leave_type.Selected.Value = "Full day", "8", "4") 

    the error is "If is an unknown or unsupported function".

     

    not sure what else to try..

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @grace3 

    Not sure what you mean about deleting drop downs from your SharePoint list!

    You don't need (and don't want) to change anything in your list!

    I was referring to removing the controls from your app.

     

    As for the formula...well, I though it was just how you typed it in your post, but if you really do have the formula as:

     if (leave_type.Selected.Value = "Full day", "8", "4") 

    Then yes, it is wrong.  It should be:  If(leave_type.Selected.Value = "Full day", "8", "4") 

    Everything in PowerApps is case sensitive.

  • grace3 Profile Picture
    30 on at

    oops I missed the lowercase "if". That was embarrassing, sorry! 

    Maybe my form was glitchy. I am redoing the entire form now. Re-adding all fields from SP and adding the formula exactly how you suggested above. I will let you know if it works. Thank you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard