cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MauriceSmulders
Level: Powered On

Filter Galery based on button selection

Hi there, 

 

I am fairly new to PowerApps and have a question regarding filtering a gallery on screen 2, based on the selection of a button on screen 1.  let me elaborate on both screens. 

 

Screen1 is a graphical roadmap showing four phases (like a flow diagram) with buttons assigned to the areas of the phase. 

- Button 1 = Phase 1
- Buttone 2 = Phase 2

- Etc. 

 

Each of the buttons Navigate to the same screen 2 with Navigate(Deliver,ScreenTransition.Fade). 

Now I would like to filter the Gallery on screen 2, based on the button that was chosen to (e.g. button phase 2 was chosen, I would like the Gallery on screen 2 to be filtered by the phase that was selected to get to screen 2. 

 

Could you please be of assistance?

 

Thanks!


Maurice

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Filter Galery based on button selection

Hey Maurice, it sounds like you need to pass a variable from screen 1 to screen 2 and then set up your filter on screen 2 depending on what is passed (or not passed). 

 

To pass a variable, you can edit your Navigate code to something like this:

 

// Pass Phase 2 selection to screen 2
Navigate(Deliver,ScreenTransition.Fade, {Phase: 2})

You would then need to set a filter based on the variable, which depending on how your data is set up in the Gallery could be easy or a bit tricky. In fact, I would actually start with that part: what in the Gallery's data relates to the selection you are making and then structure the variable you pass based on that.

 

I'd be happy to go more in-depth if needed but hopefully that gets things moving in the right direction!

7 REPLIES 7
Super User
Super User

Re: Filter Galery based on button selection

Hey Maurice, it sounds like you need to pass a variable from screen 1 to screen 2 and then set up your filter on screen 2 depending on what is passed (or not passed). 

 

To pass a variable, you can edit your Navigate code to something like this:

 

// Pass Phase 2 selection to screen 2
Navigate(Deliver,ScreenTransition.Fade, {Phase: 2})

You would then need to set a filter based on the variable, which depending on how your data is set up in the Gallery could be easy or a bit tricky. In fact, I would actually start with that part: what in the Gallery's data relates to the selection you are making and then structure the variable you pass based on that.

 

I'd be happy to go more in-depth if needed but hopefully that gets things moving in the right direction!

MauriceSmulders
Level: Powered On

Re: Filter Galery based on button selection

Hi wyotim,

 

Thank you for the quick reply and help already!

Let me provide some more detailled expalantion.

 

Screen 1: overview of innovation Phases.

- Phase: Discover

- Phase: Develop

- Phase: Deliver & Test
- Phase: Scale 

 

Each of these phases on Screen 1 has a button next to it (i.e. DiscoverButton, DevelopButton, etc.).

By clicking the button the user should be able to navigate to Screen number 2, passing a value from the button to be used as a filter on the Gallery of screen 2. i.e. clicking DiscoverButton, navigate to Screen 2 & pass value Phase=Discover.

 

Screen 2 has a gallery with as a data source a list on Sharepoint, see capture below.

Now, by clicking the DiscoverButton I would like the Gallery to be filtered based on the Phase value of DiscoverButton: filtering the galery for Phase=Discover.

 

I have now set up the button of PhaseSmiley Very Happyelivery on Screen1 as follows:

 

Navigate(['Service Offering Overview'],ScreenTransition.Fade, {Phase: Delivery})

Though, I am getting an error message: "Incompatible type. We can't evaluate your formula becuase the context variable types are incompatible with the types of values in other places in your app".

 

Hope this makes my ambitions a bit clearer. 

 

Thank you for your help. 

 

Super User
Super User

Re: Filter Galery based on button selection

Try this:

 

Navigate('Service Offering Overview', ScreenTransition.Fade, {Phase: "Delivery"})

I copied your code but I removed the square brackets from the screen name as I believe those denote a list in PowerApps and I added double quotes around Delivery as it appears to be a text field in your screenshot. I think that is where the incompatible type error is coming from. Let me know if that doesn't work and we'll give it another go!

MauriceSmulders
Level: Powered On

Re: Filter Galery based on button selection

I've now tried to make another column in my list called InnoPhase with integers associated to the Phase that was a string. (i.e. Phase= Discover; InnoPhase =1). 

 

I now made a dummy button with your code, slightly altered to the dummy button:

 

Navigate('Service Offering Overview',ScreenTransition.Fade, {InnoPhase:1})

This works!!

Don't know why the string pass does't seem to work, though. 

 

Now on screen 2 I have used thefollowing filter to streamline the Gallery based on the Phase. 

 

Filter('Orchestrated Innovation Database', 'Orchestrated Innovation Database'.Phase = InnoPhase)

Giving me an error "Delegation warning. This part "Filter" of this formula might not work correctly on large data sets. "The datasource might not be able to process the formula and might return incomplete dataset.".

 

 

 

Super User
Super User

Re: Filter Galery based on button selection

For the delegation error, try this:

 

Filter('Orchestrated Innovation Database', Phase = InnoPhase)

 

You don't need to reference the table again (e.g. 'Orchestrated Innovation Database'.Phase) as it is implied from the previous reference in the Filter statement. I would think that is where the delegation warning is coming in but it could be something else. Maybe try that though and let me know if it doesn't do the trick.

MauriceSmulders
Level: Powered On

Re: Filter Galery based on button selection

Yes! that worked  Smiley Happy 

 

Thank you for your help. 

Super User
Super User

Re: Filter Galery based on button selection

Glad to be able to help! Smiley Very Happy

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Tomorrow, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 281 members 4,646 guests
Please welcome our newest community members: