Forum Discussion
How to filter a gallery by using buttons
Hi there,
I have 2 buttons
In Progress and Complete
I have set 2 variables
- varbtnCompleteTab and
-varbtnInProgressTab
I have set the variables like so on the button OnSelect
Set(varbtnInProgressTab,"New")
and Set(varbtnCompleteTab,"Complete")
On the items Gallery I have
If(varbtnCompleteTab = "Complete",
Filter('DataSource','Event Status'= varbtnCompleteTab),If(varbtnInProgressTab ="New",Filter('ESC-Request','Event Status'= varbtnInProgressTab)))
When i load the app and select the first button In Progress it filters and also the second one (Complete button).
My Problem :
But when i click it again it does nothing and also when i load the app the first time there is no data until i press the button?
What am i doing wrong?
Thanks
- Eva VogelSteel Contributor
Hi Patrick Rote, your IF-Logic maybe causing the unexpected, but logically the App is alright. At the first Runtime your logic can select from the filter criteria, but only from the first IF. The next, nested IF Funktion does not find any Data left then...
I would like to suggest, that your IF Logic can be simplified with the SWITCH (this OR This OR This OR That :)) Function,
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-if
only an idea... With that function two filters can be reviewed at the same (run)time.
Another idea: you can nest your 2 variables in items of a criteria "collection" to choose from.
To get a very good introduction for free: Laura Rogers published to today an invitation to register for a powerapps free training day! I highly recommend her brilliant learning content to you, she explains it in an understanding manner: https://www.iwmentor.com/courses/powerapps-introduction
Hope that helps, Greets from Eva.
- Patrick RoteIron ContributorThanks Eva. The link you sent is in german. I wished i understood.
Can please give me of an example using the switch. I'm a bit novice to powerapps- Eva VogelSteel Contributor
Hi Patrick Rote, I am sorry for this .
In fact translating is easy, when you look at microsofts hyperlinks: In the position of "de-de" of the URL you only have to replace it with "en-us", I adjusted this URL and you can now read in english. Never mind. I added you a useful link to learn more about PowerApps: The best content I fould so far is in Laura Rogers' Site, called iwmentor.com. You can follow her tons of videos from 2017 concerning Power Automate and PowerApps as well. She's the best. Enjoy learning, as i still do
Eva
- Eva VogelSteel Contributor
Hi Patrick Rote, sorry for late answer, am very busy... Theres a good video for you from April Dunham about Filtering a List in PowerApps with a Filter Button.
https://youtu.be/8bNCBe2wzYI?list=TLPQMTAxMTIwMjBDVerNQxedog&t=563
There are so many ways to filter, she knows them all 🙂
Have a good day,
Eva
- Patrick RoteIron Contributor
Thanks Eva Vogel for the videos
But there wasn't any example filtering gallery by using multiple buttons..
I think i'm close looking at my OP but just having issue combining multiple filters
- Patrick RoteIron Contributor
Thanks Eva Vogel I ended up using dropdown list instead of buttons.
It was clearer to me that using different buttons to filter...
Hope i get to see how its is being used soon
- James_CoatesCopper Contributor
Patrick Rote If you still require this you can try the following
you can set the Filter(Datasorcename, Progress = VarbtnInProgressTab, Complete = varbtnCompleteTab)