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

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
Community Support
Community Support

HI @HumbleGenius,

 

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
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)

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

 

 

 

@HumbleGenius,

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.  

Community Support
Community Support

HI @HumbleGenius,

 

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

Thank you so very much! It worked. 

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (4,152)