cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
G-E-0
Helper I
Helper I

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

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!

8 REPLIES 8
BCBuizer
Super User
Super User

Hi @G-E-0 ,

 

Try with .Value added:

 


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

 

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

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.

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

RandyHayes
Super User
Super User

@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?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@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
Super User
Super User

@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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@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
Super User
Super User

@G-E-0 

What is your DataSource?

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

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,415)