cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Passing Collection values?

Hellow PowerApps Community,

 

I'm stumped on how to pass information from a collection to a gallery. 

 

  • I've successfully created a collection
  • Successfully populated a drop-down button with the collection info
  • But, I can't figure out how to pass the selected collection option from the drop-down button to my gallery

 

Collection_Question.jpg

Thanks, 

HG

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

HI @Anonymous,

 

I agree with @Drrickryp and @CarlosFigueira's thought almost.

 

Please take a try with the following formula:

Filter('External Table Data source',Treatment=Dropdown1.Selected.Value)

or

Filter('External Table Data source',Treatment=Dropdown1.Selected.Result)

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
CarlosFigueira
Power Apps
Power Apps

You can reference the 'Selected' property of the dropdown in the gallery Items property to filter it based on the dropdown selection. Something like the expression below:

Filter(
    YourCollection,
    Treatment_ID = Dropdown1.Selected.Treatment_ID)
Anonymous
Not applicable

Thank you CarlosFigueira for your quick response. The solution you provided does work when only using the Treatment _ID. 

 

But let's say that I wanted to:

 

  1. Add a new Data Source that the drop down button will search on using the Treatment collection column instead of the original Treatment_ID  to filter my gallery.

When I attempt to run this setup I receive an error:

Error_2.png

 

Here is the new setup: 

Treatment_2.png

 

 

 

@Anonymous,

I think the answer for your follow up question regarding your new example, is simpler than you think.  In the example, you are using the Distinct function to create the collection for your dropdown.  This is not really necessary if the datasource for the dropdown Treatment column is unique.  Carlo's solution will work nicely for that because the Dropdown is displaying one column of an entire record and the other columns not shown can be referenced: If that is the case, you would simply set the Items property of your gallery to Filter(Treatment_Collection,Treatment=Dropdown1.Selected.Treatment).

 

The Distinct() function is useful if you want to derive a unique list of treatments from an external table that contains duplicate treatments in the Treatment column.  When you use the Distinct() function you create a one column table with the column name = Result. If you use that as the Items property of your Dropdown, assuming the Dropdown is named Dropdown1, to filter your data source, you would need to set your gallery Items property to Filter(Treatment_Collection, Treatment=Dropdown1.Result).  You shouldn't get an error in this case since both conditions of the Filter are Text.  

v-xida-msft
Community Support
Community Support

HI @Anonymous,

 

I agree with @Drrickryp and @CarlosFigueira's thought almost.

 

Please take a try with the following formula:

Filter('External Table Data source',Treatment=Dropdown1.Selected.Value)

or

Filter('External Table Data source',Treatment=Dropdown1.Selected.Result)

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Thank you so very much! It worked. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,606)