cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate III
Advocate III

Collect function with form data and input data

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Advocate III
Advocate III

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.

View solution in original post

2 REPLIES 2
Advocate III
Advocate III

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.

View solution in original post

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


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (69,606)