cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
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
Highlighted
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

Highlighted
Frequent Visitor

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,642)