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 function with ...
Power Apps
Answered

Collect function with form data and input data

(0) ShareShare
ReportReport
Posted on by 95

I have a gallery called MyGallery where the user will select some data. There are a fields in the gallery. Let's call them MyGalleryData1 and MyGalleryData2.

 

And there are a couple fields I want the user to input outside of the gallery after selecting an item in the gallery. Let's call them Input1 and Input2.

 

I want to collect all the data from both the gallery and the inputs into a collection called MyCollectedData.

 

I'm using this formula OnSelect for a button to collect the data.

 

Collect(MyCollectedData,{Item1:MyGallery.Selected.MyGalleryData1,Item2:MyGallery.Selected.MyGalleryData2,Item3:Input1.Text,Item4:Input2.Text})

 

Is there a way to reference the all the items in a selected gallery? My gallery actually has a dozen or so items, so I don't want to individually specify them 1 by 1 in the collect formula.

 

I know that if I don't have the other inputs and just want to collect the gallery I could use this formula.

 

Collect(MyCollectedData,MyGallery.Selected)

 

And this would collect all the columns of data from the gallery's data source. Is there a way to add the inputs to this simple formula?

Categories:
  • Verified answer
    JohnMacDougall Profile Picture
    95 on at

    I was able to use this formula to accomplish the goal.

     

    Collect(MyCollectedData,AddColumns(Table(MyGallery.Selected),"CollectedInput1",Input1.Text,"CollectedInput2",Input2.Text))

     

    But it seems like there should be a more simple way without needing to convert the selected gallery item to a table then add columns to the table.

     

    Hoping there's a more elegant solution.

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Thanks for sharing your solution, always glad to see people come back and let us know how they solved things,

     

    I would have solved it a similar way, and there's definitely a Longer way (referencing individual columns of myGallery.Selected), and as for shorter, your solution seems like one of the shorter ways to me 🙂

     

    Cheers,

    Sancho

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard