I have built an app with records that have a data field of Days Old. I'd like to filter the main gallery using buttons. For example, when I press a button, it should only return records with values of 0 to 5 in the Days Old field. How do I accomplish this? I'm going to have one button for all fields, one for <5 days, one for 6-10 days, and one for >10 days.
Solved! Go to Solution.
The buttons aren't working. The gallery doesn't return records for any of the buttons. My formula (i had to alter a little) is Filter('Alarm Tracking',If(variable1,Value('Days Old')<5 && Value('Days Old')>0, true),If(variable2,Value('Days Old')>6 && Value('Days Old')<10, true),If(variable3,Value('Days Old')>10, true)).
Also, what do I add so that the All Tickets button returns all records?
I have attached a GIF that shows a simple test I did using a scenario similar to yours. Here are the important values from the test:
OnSelect of Variable1 Button:
Set(variable1, true); Set(variable2, false); Set(variable3, false)
OnSelect of Variable2 Button:
Set(variable2, true); Set(variable1, false); Set(variable3, false)
OnSelect of Variable3 Button:
Set(variable3, true); Set(variable1, false); Set(variable2, false)
OnSelect of All Accounts Button:
Set(variable1, false); Set(variable2, false); Set(variable3, false)
Items property of the Gallery:
Filter(Accounts, (variable1 && 'Account Name'= "Account One") || (variable2 && 'Account Name' = "Fourth Coffee (sample)") || (variable3 && 'Account Name' = "Adventure Works (sample)") || (!variable1 && !variable2 && !variable3))
Based on this example, your formulas should be something like the following:
Items property of the Gallery:
Filter('Alarm Tracking', (variable1 && Value('Days Old')<5) && Value('Days Old')>0, true) || (variable2 && Value('Days Old')>6 && Value('Days Old')<10) || (variable3 && Value('Days Old')>10) || (!variable1 && !variable2 && !variable3))
OnSelect of Variable1 Button:
Set(variable1, true); Set(variable2, false); Set(variable3, false)
OnSelect of Variable2 Button:
Set(variable2, true); Set(variable1, false); Set(variable3, false)
OnSelect of Variable3 Button:
Set(variable3, true); Set(variable1, false); Set(variable2, false)
OnSelect of All Tickets Button:
Set(variable1, false); Set(variable2, false); Set(variable3, false)
Let me know if this helps.
---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.
Thanks!
Hardit Bhatia
https://thepoweraddict.com
I'm having trouble with the Items formula. When I get to the 2nd variable and input Value, 'Days Old' is not a choice for the field but 'Days Old Datacard' is.
Filter('Alarm Tracking', (variable1 && Value('Days Old')<5) && Value('Days Old')>0, true) || (variable2 && Value('Days Old')>6 && Value('Days Old')<10) || (variable3 && Value('Days Old')>10) || (!variable1 && !variable2 && !variable3))
What if i also wanted to exclude rows where the field Condition had a status of 'Resolved'? Would that just be adding the following to the items formula for the gallery? &&Condition<>"Resolved"
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
194 | |
69 | |
49 | |
47 | |
19 |
User | Count |
---|---|
249 | |
126 | |
84 | |
75 | |
74 |