cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Filter with buttons

Hi everyone,

 

Is it possible to filter a database using a button?

I am trying to build an app where I can filter the same database in different ways by clicking on different button.

Is it possible?

1 ACCEPTED SOLUTION

Accepted Solutions
Resolver III
Resolver III

Off the top of my head:

Button1.OnSelect:

UpdateContext({FilterMode: 1})

Button2.OnSelect:

UpdateContext({FilterMode: 2})

 

Database Items:

If(FilterMode = 1, Filter(<Source>,<Condition1>),
FilterMode=2, Filter(<Source>,<Condition2>),
...
)

Or you can have the onselects add values etc to allow for multiple filters, or just multiple Contexts to handle multiple selections

View solution in original post

2 REPLIES 2
Resolver III
Resolver III

Off the top of my head:

Button1.OnSelect:

UpdateContext({FilterMode: 1})

Button2.OnSelect:

UpdateContext({FilterMode: 2})

 

Database Items:

If(FilterMode = 1, Filter(<Source>,<Condition1>),
FilterMode=2, Filter(<Source>,<Condition2>),
...
)

Or you can have the onselects add values etc to allow for multiple filters, or just multiple Contexts to handle multiple selections

View solution in original post

It worked. Thank you very much.

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (69,040)