Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

ComboBox resets after the patch function is used

(0) ShareShare
ReportReport
Posted on by 892

Reading through old posts about how to prevent a combobox from resetting. There is no ClearCollect function on the app...

I'd really like to keep showing the selected item after I hit the Save button. (Data is connected to Dataverse)

Skärmavbild 2021-12-15 kl. 11.02.48.png

Skärmavbild 2021-12-15 kl. 10.17.07.png

Multiple choices not allowed and the combo box is showing records from a Project table.

The Default is expecting a Record and using MySelection only in that property gives errors.

In the OnSelect property It worked to add Set(MySelected, ComboBoxProject.Selected) - though adding a .Value or .Result is giving errors.

(Been trying options presented in other threads.)

  • Gyllentid Profile Picture
    892 on at
    Re: ComboBox resets after the patch function is used

    @andersen_mikael yeah I am very glad for that, makes it better.

  • andersen_mikael Profile Picture
    15 on at
    Re: ComboBox resets after the patch function is used

    Great that it works. The advantage is of course that you avoid a Filter call 🙂

  • Gyllentid Profile Picture
    892 on at
    Re: ComboBox resets after the patch function is used

    Hey @andersen_mikael 

     

    Both of these worked: 

    DefaultSelectedItems: ThisItem.Project 

    DefaultSelecectItems: Gallery1participant_1.Selected.Project

    Great! It is in a Gallery Control. 🙂 Thank!

  • Verified answer
    andersen_mikael Profile Picture
    15 on at
    Re: ComboBox resets after the patch function is used

    For ComboBox's you have to use the DefaultSelectedItems and the record(s) provided has/have to match up with the records provided/specified in Items.

     

    Assuming that Items is equal to 'Project Divisions' in your case, the filter function does exactly that - produce records matching up with the Items.

     

    Since it's in DataVerse you might be able to specify it as follows (depends on how the Project column is specified and how the form is setup)

    DefaultSelectecItems: Parent.Default    //Assuming the combobox is in a data card for the Project field 

     

    Other options that might work.

    DefaultSelectedItems: ThisItem.Project 

    DefaultSelecectItems: Gallery1participant_1.Selected.Project

     

     

     

     

     

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at
    Re: ComboBox resets after the patch function is used

    Okay well i am glad to here it is working now 🙂

  • Gyllentid Profile Picture
    892 on at
    Re: ComboBox resets after the patch function is used

    Hi @AJ_Z Unfortunately, both gave errors. Though I might be missing something there...

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at
    Re: ComboBox resets after the patch function is used

    Happy to have been of help so did the MySelected.Name or MySelected not work in default selecteditems

  • Verified answer
    Gyllentid Profile Picture
    892 on at
    Re: ComboBox resets after the patch function is used

    I wondered about that too, in the other threads posters said it should be in the Default property so I followed that. However, I was just listening to Shane Youngs video about it and he said it should be in DefualtItemsProperty.

     

    In that DefaultItemsProperty it worked to do a filter: 
    Filter('Project Divisions', Name = Gallery1participant_1.Selected.Project.Name)

     

    Thanks for the help!

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at
    Re: ComboBox resets after the patch function is used

    even though its not multi select put it in default selected items instead of default lets see what happens

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at
    Re: ComboBox resets after the patch function is used

    try put it in defaultselecteditems instead try with brackets and without brackets

    if my comments are helpful be sure to Like/Kudo them and if it is your solution please click accept as solution

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard