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 / How to re-add a specif...
Power Apps
Answered

How to re-add a specific value to a combobox if removed?

(0) ShareShare
ReportReport
Posted on by 628

Scenario: When certain conditions are met DefaultSelectedItems is populated with a default item. If this default item is removed while conditions are still true, add the item back. Disabling the edit mode of the combobox in this situation isn't an option since we still want users to have the ability to add additional items beyond the default.

 

Any help is appreciated, thanks!

Categories:
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @dlprentice ,

     

    During patch you can check the condition and if its not added in the value you can  concatenate the this default value before patch ?

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @dlprentice ,

     

    I did a demo for you.

     

    1\ Add a button control and set its onselect property to:

     

    Set(A,1)

     

    //The variable is a condition

     

    2\ Add a button control and set its onselect property to:

     

    Set(A,0)

     

     

    3\ Add a combo box control and set its Items property to:

     

    Table({Value:"a"},{Value:"b"},{Value:"c"})

     

     

    Set its Onselect property to:

     

    Set(Thevar2,1)

     

     

    Set its onchange property to:

     

    If(A=1&&Thevar2=1,Set(Thevar2,0);ClearCollect(Col,{Value:"a"},Filter( ComboBox1.SelectedItems,Value<>"a"));Reset(ComboBox1))

     

     

    Set its DefaultSelectedItems property to:

     

    Col

     

     

    The result is as follows:

    AAA.gif

     

    Best Regards,

    Wearsky

     

  • dlprentice Profile Picture
    628 on at

    I took the principles of what you described here and came up with this. It works for me.

     

    DefaultSelectedItems

     

    If(
     isNew=true And DataCardValue27.Selected.Id = 6 Or DataCardValue27.Selected.Id = 14,
     Filter(
     Choices('Requests for Change'.'FootPrints Teams'),
     Id = 48
     ),
     Parent.Default
    )​

     

     
    OnChange

     

    If(
     isNew = true And Not(48 in DataCardValue58.SelectedItems.Id) And (DataCardValue27.Selected.Id = 6 Or DataCardValue27.Selected.Id = 14),
     Reset(DataCardValue58),
     Parent.Default
    )​

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard