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!
Hi @G-E-0 ,
Try with .Value added:
Patch(TestCollection, Defaults(TestCollection), {Project:MyCombobox.Selected.Value})
I have trie this befor, but i tried it again but it does't work. This is the result
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.
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?
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?
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.
Nice, I understand.
If i want it and for offline mode. Maybe you know why me collection is like empty ?
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.
What is your DataSource?
If it is SQL, then turn the Explicit Column Selection feature off in your app settings.
User | Count |
---|---|
125 | |
87 | |
86 | |
75 | |
69 |
User | Count |
---|---|
215 | |
181 | |
139 | |
97 | |
83 |