i want to patch collection of records of login user to sharepoint list. again next time the user should see his records and edit them in the grid table created in gallery.
i created collection in App Start & add collect function in Gallery Record to collect the changes.
how to create patch function for this . if i use below patch it is created repeated duplicate records.
OnStart:
ClearCollect(Colpat,ShowColumns(Table(Defaults('ABC')),"User","Manager","Title","Status","CompletedDate","ID"));
Clear(Colpat)
Collect button in gallery:
Collect(Colpat,{Title:ThisItem.Title,Status:Dropdown.SelectedText.Value,User:ThisItem.'Created By',Manager:ThisItem.manager,CompletedDate:DatePicker1.SelectedDate})
Save button outside gallery:
Patch(
'ABC',
Colpat)
Yes,bringing records from another list. And patching them to new sp list
Seems I got it wrong
You bring some records up
But u do not edit all of them
And want only patch on the edited records to the Datasource?
not working above codes
Multiple records which is why you use ForAll-Yes
but by using below code i can able to create mutiple records in single shot. but i want to avoid duplicate and edit submitted records.
Patch(
'ABC',
Colpat)
I guess you have Multiple records which is why you use ForAll
The ForAll need a collection to pick item one after the other
ForAll(Colpat, Patch(ABC, Lookup(ABC, Id= Colpat.ID,{PatchColumns})))
or
ForAll(Colpat,UpdateIf(ABC, ID = Colpat.ID,{Columns}))
not working
ForAll(Patch (ABC, Lookup(ABC, ID = Colpat.ID, {Colpat})))
Added ID in collect button
Collect button in gallery:
Collect(Colpat,{Title:ThisItem.Title,Status:Dropdown.SelectedText.Value,User:ThisItem.'Created By',Manager:ThisItem.manager,CompletedDate:DatePicker1.SelectedDate,'ID':ThisItem.ID})
You will need to Add the item ID to the Collection
And use the ID for a Lookup formula to patch the corresponding record in Sharepoint List
The Patch will be
Patch (ABC, Lookup(ABC, ID = Collection.ID, {Colpat})))
I guess the Collection is just one single record, If they are multiple records you need to use the ForAll function
WarrenBelz
146,605
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,946
Most Valuable Professional