0
votes

I have the following Text Fields that are being both updated and created as new, e.g. someone will come in and create a new record from blanks OR update existing records based on a gallery selection beforehand.

Is there a way to bulk update/create the backend SharePoint List with the updated values without writing a super long patch function? My SharePoint List is called Scores and there are 36 columns created to receive this data.

enter image description here

1

1 Answers

0
votes

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:

  1. 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.
  • Something like:
ClearCollect(colSomething, 
    Filter(myDataSource, status = new)
)
  1. 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.
  1. 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!