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 / Collect all items in g...
Power Apps
Answered

Collect all items in gallery

(0) ShareShare
ReportReport
Posted on by 204

 

ForAll(MyGallery; Collect(myCollection; {a:FieldA; b:FieldB}))

I'm trying to collect two fields for every item in the gallery. How should the code be written?

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @agneum 

    I think you were just missing the ".AllItems" after MyGallery.

    ForAll(MyGallery.AllItems; Collect(myCollection; {a:FieldA; b:FieldB}))

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Verified answer
    FacundoGorla Profile Picture
    293 on at

    This works:

    ForAll(MyGallery.AllItems; Collect ( myCollection; FieldA.Text; FieldB.Text ) )

     

    Depending what type of data FieldA and FieldB have.

    I recomend to add Clear(myCollection) before the ForAll depending on the case.

  • MW Profile Picture
    Microsoft Employee on at

    If you ran in the same issue, being unable to load all items in a Gallery, please vote and support this idea: Enable the option to load all items in a Gallery · Community (powerapps.com)

  • RobD390 Profile Picture
    8 on at

    The semicolon after all items is wrong.  It needs to be a comma.  

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 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard