cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HumbleGenius
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
v-xida-msft
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
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)

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.  

v-xida-msft
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (55,029)