cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SteveDesmedt
New Member

Filter in Gallery based on dropdown

Hi All, 

 

I'm new to PowerApps and try to filter a gallery based on a dropdown box.  So i hope anyone can give me any suggestions.

Here's is what i'm trying to achieve :

 

OnStartUp :

I make a 2 collections based on an Excel on Ondrive ;
 
Collection1 :
ClearCollect(collection1;
        AddColumns(xlsDatasource;
            "isSelected"; false
        )
)
 
Collection 2:
ClearCollect(collection1Filter;xlsDatasource);;
Collect(colInstructionsFilter;{Onderwerp:""});;
 

Screen1 : 

I created a gallery (galIcollection) and set the items property as :

collection1

 

I created a dropdownbox (rpSubjectFilter) where i've set the items property as :        (showing unique values)
Sort(Distinct(collection1Filter.Onderwerp;Onderwerp);Result;Ascending)

 

OnChange property of the dropdown box, i've set as :

Filter(collection1.Onderwerp;galIcollection.Selected.Onderwerp=drpSubjectFilter.Selected.Result)

 

The problem is that the gallery isn't filtered.

Someone any idea ? 

 

Kind regards 

 

Steve

1 ACCEPTED SOLUTION

Accepted Solutions
v-monli-msft
Community Support
Community Support

Hi @SteveDesmedt ,

 

Have you tried what @mdevaney  suggested? Did it work?

 

Regards,

Mona

Community Support Team _ Mona Li
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

2 REPLIES 2
mdevaney
Super User
Super User

@SteveDesmedt 

I think your issue is with the code you placed in the OnChange property of your dropdown.  To filter the gallery based on the dropdown selection I would put your code in the Items property of the gallery instead and make a few changes to it...

 

Your code

 

Filter(collection1.Onderwerp;galIcollection.Selected.Onderwerp=drpSubjectFilter.Selected.Result)

 

My suggested code for gallcollection Items property

 

Filter(collection1;Onderwerp=drpSubjectFilter.SelectedText.Value)

 

You might have adjust my code if I got the column or control names wrong but I think it should work.  Let me know!

 

Also, I did a mini-tutorial on this topic for another user yesterday.  You might want to check it out.  Its way simpler than your scenario but maybe you can read it and get an idea of how to implement in your app.  https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Create-multiple-data-cards-from-one-...

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

v-monli-msft
Community Support
Community Support

Hi @SteveDesmedt ,

 

Have you tried what @mdevaney  suggested? Did it work?

 

Regards,

Mona

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

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,951)