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 / Patch(MyCollection, .....
Power Apps
Unanswered

Patch(MyCollection, .........., Combobox.Selected ) doesn't work.

(0) ShareShare
ReportReport
Posted on by 24

Hello friends,

I have problem with to save data to collection with combobox.

My code to button for save is :

Patch(TestCollection, Defaults(TestCollection), {Project:MyCombobox.Selected})

 

I have and this code onStart:

ClearCollect(TestCollection; {Project:  "" });
Remove(TestCollection; First(TestCollection));

 

All this working good for text label or dropdown but for combobox doesn't work.

Thank you!

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,833 Super User 2026 Season 1 on at

    Hi @G-E-0 ,

     

    Try with .Value added:

     

    
    Patch(TestCollection, Defaults(TestCollection), {Project:MyCombobox.Selected.Value})

     

     

  • G-E-0 Profile Picture
    24 on at

    I have trie this befor, but i tried it again but it does't work. This is the resultComboboxError.png

     

    The error is : "The function 'Patch' has some invalid arguments' .

     

    Is different the the names just because i have other names in collection and Combobox.

  • G-E-0 Profile Picture
    24 on at

    I tried this again and work but work only outside the form. I need to have the combobox inside the form. 

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

    @G-E-0 

    If this is in a form, then you should be focused on the Update property of your form and not with collections or patch statements.  So, not entirely sure what you mean by the form and outside of the form.  Please clarify.

     

    As for your patch statement, the use of Defaults on it is not relevant as what you are doing in that formula is trying to add a record.  So your formula should be: Collect(yourCollection, {Project: DataCardValue3.Selected.Value})

     

    Beyond that, please clarify why this is a form and yet there are patches and collections being used.  That will help describe your scenario better. 

    Also, What kind of column is Project and how are you initially adding that to your collection?

    And finally, what is the items property of the DataCardValue3 control?

  • G-E-0 Profile Picture
    24 on at

    @RandyHayes 

    Thanks for the first message.

    What I want is to put in a collection all my data from the database. And through the form to edit or add, and whatever else is needed. First make the changes collection and then go to save the changes and add them back to the database. To make the program faster.

    What are you think is good idea? Or not worth it?

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

    @G-E-0 

    Not worth it!  You are actually slowing down your app performance as you are trying to then load all the data into your app memory.  Then work with it there.  Then push it back.

    First, this is a lot of work for you to write all the formulas for and troubleshoot.  Second, you run the risk of the user exiting the app prior to saving the data.

     

    If this is a mobile disconnect-enabled app, then it is a totally different story.  But if this is a basic app, you are better off to just work with the datasource directly and skip all the overhead of collections and the work of trying to build your own mechanism to interact with the data.

    Keep in mind that the session you connect to in the cloud (when you start the app) already basically does what you are trying to then duplicate in your app.

  • G-E-0 Profile Picture
    24 on at

    @RandyHayes 

    Nice, I understand.

    If i want it and for offline mode. Maybe you know why me collection is like empty ? 

    PowerAppsForum1.png

     

     

     

     

     

     

    I have write this code for create the collection and insert data. I write it on OnStart(App).

    ClearCollect(
           ExpenseEntriesCollection,
           Filter('Expense Entries',
                 createdby.internalemailaddress=UserEmail
           )
    )

     

    Thank you!

    The before anser who give me work, but not  it does not suit me because I need more input types in form.

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

    @G-E-0 

    What is your DataSource?

    If it is SQL, then turn the Explicit Column Selection feature off in your app settings.

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard