cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helen_BB
Helper III
Helper III

Editing multiple records in a gallery - help.

Hi 🙂 

 

ive been trying to edit multiple records in a gallery as part of my app - ive researched and tried some of the options but i cant seem to get it to work. 

 

so in my gallary i have put some text inputs the deafult to  - for example thisitem.how. i want my users to be able to update the first sections and then when they press save it patches them all to the sharepoint list. (see powerapps gal attachments) 

 

i have managed to add the data to a collection however because of the additional text input fields the collection does not have the same fields as the sharepoint list so the basic : 

Patch(ChecklistItemsSource , CheckedItems)

does not work. 

 

i have tried the following..

 

ForAll(obj,Patch('PDP Objectives',LookUp('PDP Objectives', ID = obj[@ID]),{How:[@TextInput1_13]}))

 

which returns no errors but nothing changes in the sharepoint list. - can someone please help!. 

 

Thank you 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Mike8
Memorable Member
Memorable Member

Hello Helen_BB,

The following works if 'PDP Objectives' is a collection. I hope it also works for a sharepoint list.
Patch('PDP Objectives','PDP Objectives',ForAll(Gallery1.AllItems,{How:TextInput1_13.Text}))

The expression:
ForAll(obj,Patch('PDP Objectives',LookUp('PDP Objectives', ID = obj[@ID]),{How:[@TextInput1_13]}))
iterates on obj.
I think obj is a collection and not the gallery that contains the TextInput1_13. So you don't have access to each TextInput1_13 control in the gallery. 
Also How expects a string. So i changed How:[@TextInput1_13], to How:TextInput1_13.Text 





View solution in original post

Let's try if the following works..

UpdateContext({vGalleryItems:Gallery1.AllItems});
ForAll(vGalleryItems,Patch(obj,LookUp(obj,ID=vGalleryItems[@ID]),{How:vGalleryItems[@TextInput1_13].Text}))

View solution in original post

11 REPLIES 11
Mike8
Memorable Member
Memorable Member

Hello Helen_BB,

The following works if 'PDP Objectives' is a collection. I hope it also works for a sharepoint list.
Patch('PDP Objectives','PDP Objectives',ForAll(Gallery1.AllItems,{How:TextInput1_13.Text}))

The expression:
ForAll(obj,Patch('PDP Objectives',LookUp('PDP Objectives', ID = obj[@ID]),{How:[@TextInput1_13]}))
iterates on obj.
I think obj is a collection and not the gallery that contains the TextInput1_13. So you don't have access to each TextInput1_13 control in the gallery. 
Also How expects a string. So i changed How:[@TextInput1_13], to How:TextInput1_13.Text 





Hi Mike 🙂 thank you for your help.

 

This worked 😄 - thank you so much!! 

Hi @Mike8

 

thank you again for all your help so far however i bumped into a bit of a problem. 

 

the above works fine for an unfiltered gallary however if you filter the gallary and then update it seems to update the wrong record. for example if i had 

 

Row 1

Row 2

Row 3

 

in an unfiltered gallary and i edited row 3 the functionality works great and row 3 will be edited. however if i filter my gallary so now it only shows

 

Row 3

 

instead of updating the Row 3 record it edits Row 1 record. 

 

any ideas? 

Hello Helen_BB,

Sorry for my late response. Did you find a solution for your issue?

Hi @Mike8

 

unfortunatly not no 😞 

 

Thanks for your reply. 🙂

We can make this work. Do you have an ID or an item that is unique for every record?

Yes 🙂 each one has a unique identifier.

 

Thank you for your help i really appreciate it 🙂 

 

 

 

Let's try if the following works..

UpdateContext({vGalleryItems:Gallery1.AllItems});
ForAll(vGalleryItems,Patch(obj,LookUp(obj,ID=vGalleryItems[@ID]),{How:vGalleryItems[@TextInput1_13].Text}))

OOOoooh! so far so good! just a delegation issue on the '=' and the [@ID] but i presume we can't do much about that  😄

 

ID=vGalleryItems[@ID]

 

You are a genius!! thank you so much!! 

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,413)