cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Muzammil
Level: Powered On

ForAll Patch Collection to SharePoint List Keep looping first record from Collection - Issue

Hi I'm trying to Patch Collection created through Collect to SharePoint list but it keeps saving the only first record from Collection, code as follows;

 

ForAll(FishCatchCollection, Patch('Daily Fish Catch Detail', Defaults('Daily Fish Catch Detail'), {'Vessel Name': TextInput_VesselName.Text, 'Vessel Type': DD_VesselType.Selected, Guest: DD_Guest.Selected, 'Captain Name': TextInput_Captain.Text, Hail: Value(TextInput_Hail.Text), Unload: Value(TextInput_Unload.Text), 'In / Out': DD_InOut.Selected, Reason: DD_Reason.Selected, Comment: TextInput_Comment.Text}))

I attached PowerApps Screen and SharePoint list entry, as you can see PowerApps Collection have different records, on the other hand, SharePoint list only saving the first record and loop it as many times as the collection records are.

Please advise

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: ForAll Patch Collection to SharePoint List Keep looping first record from Collection - Issue

@Muzammil 

I am assuming that all of the referenced controls (like TextInput_VesselName) are part of your Gallery.  

If that is the case, then referencing them in the way you are in your patch is going to only give you the first instance (record 1 in your case).

 

You need to reference the Controls as part of the Gallery:

ForAll(
   YouGalleryName.AllItems, 
      Patch('Daily Fish Catch Detail', 
         Defaults('Daily Fish Catch Detail'), 
         {'Vessel Name': TextInput_VesselName.Text, 
          'Vessel Type': DD_VesselType.Selected, 
          Guest: DD_Guest.Selected, 
          'Captain Name': TextInput_Captain.Text, 
          Hail: Value(TextInput_Hail.Text), 
          Unload: Value(TextInput_Unload.Text), 
          'In / Out': DD_InOut.Selected, Reason: 
          DD_Reason.Selected, 
          Comment: TextInput_Comment.Text}))

This will go through each item in your Gallery and patch it to the SharePoint list.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: ForAll Patch Collection to SharePoint List Keep looping first record from Collection - Issue

@Muzammil 

I am assuming that all of the referenced controls (like TextInput_VesselName) are part of your Gallery.  

If that is the case, then referencing them in the way you are in your patch is going to only give you the first instance (record 1 in your case).

 

You need to reference the Controls as part of the Gallery:

ForAll(
   YouGalleryName.AllItems, 
      Patch('Daily Fish Catch Detail', 
         Defaults('Daily Fish Catch Detail'), 
         {'Vessel Name': TextInput_VesselName.Text, 
          'Vessel Type': DD_VesselType.Selected, 
          Guest: DD_Guest.Selected, 
          'Captain Name': TextInput_Captain.Text, 
          Hail: Value(TextInput_Hail.Text), 
          Unload: Value(TextInput_Unload.Text), 
          'In / Out': DD_InOut.Selected, Reason: 
          DD_Reason.Selected, 
          Comment: TextInput_Comment.Text}))

This will go through each item in your Gallery and patch it to the SharePoint list.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Muzammil
Level: Powered On

Re: ForAll Patch Collection to SharePoint List Keep looping first record from Collection - Issue

Love it @RandyHayes, thank you!

Just tried it, work like a magic 🙂

Yes, all referenced controls (like TextInput_VesselName) are part of Gallery - true.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 473 members 6,324 guests
Please welcome our newest community members: