web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ForAll gallery items w...
Power Apps
Unanswered

ForAll gallery items will get the last gallery item values

(0) ShareShare
ReportReport
Posted on by 3,514

I have this gallery which contain items that were already created inside SharePoint, and i want to loop through them and update the items, when clicking on the Submit button:-

 

johnjohn123_4-1699094630697.png

 

johnjohn123_5-1699094662053.png

 

 

I tried the below  formula inside the submit button, but the issue is that all the items will get the last gallery's item values, so in the above example all items will have Quantity = 300 and Quantity Each Network = 500, and so on:-

 

 

Patch('Printing Orders Details',
 ForAll(PrintOrderDetailsGallery.AllItems,
 { ID: ID,
 Quantity: Value(PrintOrderQuantity.Text),
 'Quantity Each Artwork':PrintOrderQuantityForEachartwork.Text,
 'Network ID':PrintOrderNetworkComboBox.Selected.ID
 }
 )
)

 

and advice?

Categories:
I have the same question (0)
  • ANB Profile Picture
    7,250 Super User 2026 Season 1 on at

    Hi @johnjohn123 , Check if this can help you

    ForAll(PrintOrderDetailsGallery.AllItems As var,
     Patch('Printing Orders Details',
     Lookup('Printing Orders Details', ID = var.ID), 
     { ID: var.ID,
     Quantity: var.Quantity,
     'Quantity Each Artwork':var.'Quantity Each Artwork',
     'Network ID':var.'Network ID'
     }
     )
    )

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • johnjohn123 Profile Picture
    3,514 on at

    @ANB thanks for the reply, but i got error, that the ForAll contain invalid arguments

  • ANB Profile Picture
    7,250 Super User 2026 Season 1 on at

    Does ID is OOTB ID column from SP list? If yes then you donot have to use again for Patch.

    ForAll(PrintOrderDetailsGallery.AllItems As var,
     Patch('Printing Orders Details',
     Lookup('Printing Orders Details', ID = var.ID), 
     { 
     Quantity: var.Quantity,
     'Quantity Each Artwork':var.'Quantity Each Artwork',
     'Network ID':var.'Network ID'
     }
     )
    )

    If this does not work, then please help with screenshot of error message.

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • johnjohn123 Profile Picture
    3,514 on at

    @ANB your updated formula looks exactly as the previous formula, here is a screen shot of the error:-

     

    johnjohn123_0-1699096970404.png

     

    and yes the ID is the built-in field inside sharepoint lists

  • johnjohn123 Profile Picture
    3,514 on at

    @ANB also the  PrintOrderDetailsGallery.AllItems will get the properties values as they are stored inside sharepoint and not the values i entered inside the gallery (modified values)

     

  • ANB Profile Picture
    7,250 Super User 2026 Season 1 on at

    My Updated formula does not have ID. What is the type of 'Network ID' in SP?

     

    Thanks,

    ANB

     

     

  • ANB Profile Picture
    7,250 Super User 2026 Season 1 on at

    I tried replicating the same code with one column and it is working fine:

    ForAll(
     Gallery10.AllItems As var,
     Patch(
     TESTING11,
     LookUp(
     TESTING11,
     ID = var.ID
     ),
     {Keywords: var.Keywords}
     )
    )

    Thanks,

    ANB

  • johnjohn123 Profile Picture
    3,514 on at

    @ANB

     

     but the Gallery10.AllItems

     will store the values as they are stored inside SharePoint and not the updated ones inside the gallery,, am i correct? so at the end nothing will be updated.. this is based on my test.

     

  • ANB Profile Picture
    7,250 Super User 2026 Season 1 on at

    No, This is what I have done. I have TESTING11 SP list which has Choice column Keywords and I am using that in this code because I am assuming that  'Network ID' in SP list is also Choice type. BTW you didnt confirm on that. I asked in my previous response. What is the type of 'Network ID' in SP?

     

    Now when I select anything from choice which I have mapped to combo box in gallery, that will be patched using the above code that i have shared.

    ANB_0-1699098980277.png

     Please manually type the code rather than copy paste because it might have some spelling mistake or some extra space in column name that I gave.

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • johnjohn123 Profile Picture
    3,514 on at

    @ANB NetworkID is of type Number, but i am showing a combobox to select the related Network. as i have a separate SharePoint list named Netoworks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 509 Most Valuable Professional

#2
Haque Profile Picture

Haque 302

#3
11manish Profile Picture

11manish 265

Last 30 days Overall leaderboard