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 / For all no longer work...
Power Apps
Answered

For all no longer working in collection

(0) ShareShare
ReportReport
Posted on by 1,257 Super User 2024 Season 1

I have the following code in a couple of apps and it always worked fine but now it is only collecting the last item not all of them?  Just to say galSetLine is a dynamic gallery which I add details to as I go...

 

ForAll(galSetLine.AllItems,Collect(colViewAll,{
AllocationOrder:drpAlloctionOrder.Selected.Value,Number:cmbNumber.Selected.Title,Place:drpplace.Selected.PlaceNumber,name:txt_name.Text


}))

 

If I use the above collection colViewAll in either a gallery or table it just shows the last item collected but repeated however many lines there are in the original gallery.  so for example if I have 5 lines in galSetLine with something different in each one it just shows what was in line 5 , 5 times..

 

Is there an alternative to ForAll or some other way to collect everything in that gallery? 

 

TIA 

Categories:
I have the same question (0)
  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    I actually realise this now as I think it through that the issue is the dropdowns... I'm going to add some invisible labels to collect the dropdown info in each line in the gallery and see if that works 🙂

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    Nope that didn't work LOL !  so still have the issue 😀

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @vffdd ,

    Assuming those 4 controls are inside the gallery

    ClearCollect(
     colViewAll,
     ForAll(
     galSetLine.AllItems As aGal,
     {
     AllocationOrder: aGal.drpAlloctionOrder.Selected.Value,
     Number: aGal.cmbNumber.Selected.Title,
     Place: aGal.drpplace.Selected.PlaceNumber,
     name: aGal.txt_name.Text
     }
     )
    )

    If some are not, remove the aGal reference.

     

    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.

    Visit my blog Practical Power Apps

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    unfortunately that doesn't appear to be working for me @WarrenBelz .  The new collection (colViewall) is empty

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    by the way the same thing happens if I bypass the collection all together and patch the gallery items using ForAll straight through to sharepoint list...if 5 items in gallery the last item gets patched 5 times.. It must be something simple, however I've used this method previously a couple of times with no issues..

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    @vffdd ,

    There is something wrong here - I just tested the exact syntax on a gallery and it worked fine. The ForAll will use all items assuming at least one of those controls is in the gallery.

    WarrenBelz_0-1652907112055.png

    WarrenBelz_1-1652907136599.png

     

    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.

    Visit my blog Practical Power Apps

     

     

     

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    Thanks @WarrenBelz   just a little confused about your solution.   I actually had removed the reference to aGal because I read your comment backwards as remove if some of the fields are outside the gallery, because they aren't.🙄  but now when I add it back in  I keep getting an error in my syntax even though it's exactly the same as yours the error I'm getting is   Expected Colon We expect a colon (:) at this point in the formula.. I'm obviously doing something silly but can't see where the issue is and can you explain what aGal is?

     

    ClearCollect(
     colViewAll,
     ForAll(
     galSetAll.AllItems As aGal ,
     {
     Order: aGal.drpOrder.Selected.Value,
     Number: aGal.cbNumber.Selected.Title,
     Place: aGal.Stand.Selected.PlaceNumber,
     
     }
     )
    )

     

     

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    @vffdd ,

    You can call that whatever you want (HomerSimpson would work) - it is simply a disambiguation operator that is good to use in a ForAll reference and actually be removed if you do not have the same name in the source and destination (except if you have a mix inside and outside the galley, it is better left in).

    Where are you using this code?

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    ah ok.  So I'm using the code on a button.   When the user has entered their data in the first gallery they click on the button to view a summary of what they have added in a collection and then I will do another button to patch that info through to the sharepoint list if they are happy with it..  https://www.youtube.com/watch?v=ZEsPZm04-Z0  this is what I've followed to create both the first gallery and the summary and as I  mentioned previously it has always worked for me before?  I have it in 2 other apps

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    @vffdd ,

    Just saw it - you have an extra comma after PlaceNumber

     

    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.

    Visit my blog Practical Power Apps

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard