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

Community site session details

Session Id : mrDLPR1lHQrJz560S0hb05
Power Apps - Building Power Apps
Answered

How do I set the defaultselecteditems of a combobox using a value from a choice set

Like (0) ShareShare
ReportReport
Posted on 30 Jul 2021 16:04:14 by 92

Hi,

 

I'm struggling to set the defaultselecteditems property of my combobox with a value from a choice set that I have.

 

I'm using Microsoft Dataverse for storing my app data.

 

Here's the code I have under the DefaultSelectedItems property:

 

If(
 DataCardValue5.Selected.Value = [@'Timesheet Type'].Holiday,
 ["30"],
 [Parent.Default]
)

 

Essentially this is saying if the user selects the value Holiday in a separate combobox, then set the DefaultSelectedItems of this combobox to "30", else Parent.Default

 

Now when I run the app and select "Holiday" the combobox appears to be set as 30:

 

Capture.PNGBut it's just added the text "30" to the box, it hasn't actually selected the choice value 30. If I click the dropdown arrow for the combobox you can see that the "30" is not actually selected:

 

Capture 2.PNG

 

Here is what the above image would look like if the 30 was actually selected:

Capture 3.PNG

 

When I submit the form the field is also left blank. How do I write the above code so that it actually selects the choice set "30" and saves it to the record?

 

  • Luminait Profile Picture
    4 on 15 Nov 2023 at 17:52:43
    Re: How do I set the defaultselecteditems of a combobox using a value from a choice set

    Thanks so much for sharing your solution. The brackets were keeping me from accomplishing my task and you solved it for me!!

     

  • Golly Profile Picture
    125 on 21 Mar 2023 at 19:15:09
    Re: How do I set the defaultselecteditems of a combobox using a value from a choice set

    The brackets around [parent.defaultare important in this case, fyi.  I spent way too long trying to fix the table value before finding this post and realizing I just needed brackets around parent.default.  Thanks!

  • Verified answer
    Omainesi Profile Picture
    92 on 30 Jul 2021 at 23:42:59
    Re: How do I set the defaultselecteditems of a combobox using a value from a choice set

    Thanks for your reply, I tried your suggestion but was unable to get it to work. The solution didn't have any errors, but on form submit the field was still empty.

     

    I've persevered and spent another 2 hours on this tonight, taking my grand total on this problem to about 6 hours 🙄 but I've finally figured it out:

     

     

     

    If(
     DataCardValue5.Selected.Value = [@'Timesheet Type'].Holiday,
     [[@'Start Time Minute'].'30'],
     [Parent.Default])

     

     

     

    So for anyone who comes across this in the future, here's a breakdown:

     

    If(DataCardValue5.Selected.Value = [@'Timesheet Type'].Holiday,

    The above checks the selected value of a combobox to see if the value "Holiday" is selected, if this statement is true then it:

     

    [[@'Start Time Minute'].'30'],

    The above sets the value of the combobox in question to '30' (@'Start Time Minute' is the name of my choice set for this combobox and '30' is one of the choices).

     

    [Parent.Default])

    Else it sets the combobox to Parent.Default

     

    A final point to note was that I mentioned in the original post that my code only appeared to be adding the text "30" to the combobox, and when I clicked the arrow to view all the options, '30' wasn't highlighted. With the above code, it was still not highlighting the '30' as selected, but onsubmit it was saving "30" to the record. Strange, but to be honest I'm just happy it now works.

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on 30 Jul 2021 at 16:28:13
    Re: How do I set the defaultselecteditems of a combobox using a value from a choice set

    Try this

    Set DefaultSelectedItems for combobox is

     

    If(condition,{Value:30},{Value:ThisItem.'ColumnName'.Id})

     

     

    Example (Actual and changed using default)

    StalinPonnusamy_0-1627662727519.png

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete