Somehow you have to get each field in your app into a column in the data source. You've got to map that relationship.
An alternative to a gnarly Patch() is:
OnStart
of the app, OnVisible
of the screen or OnSelect
of an item in a gallery, create a collection of the record(s) to be edited.
ClearCollect(colSomething,
Filter(myDataSource, status = new)
)
- Then,
OnChange
of each text input box:
UpdateIf(colSomething, 1=1,
{
specificColumn1: thisTextBox.Text
}
)
- This inserts the value of the Text Box into the Collection.
- Finally, to push this all to the Data Source, you can just write:
Patch(myDataSource,
Defaults(myDataSource),
colSomething
)
...if its a new record or
Patch(myDataSource,
Filter(myDataSource, ID = varID),
colSomething
)
You need the schema (column names and data types) of the Collection to exactly match that of the Data Source for this to work. Its a nice way to handle data within your app.
Good luck!