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

Notifications

Announcements

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:
I have the same question (0)
  • 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,228 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard