cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WackdeMack
Resolver I
Resolver I

Combine toggle button with a filter function

Goodmorning all,

 

I have a PowerApp with a few fields. I want to use two toggle button to filter a yes/no column and a choice columns.

My filter works fine separately but i can't combine it. How can i use together?

 

Toggle filter.png

Toggle filter 2.png

 

I use this code for the items @ the gallery but after this i won't see all the items. I think first i need to load all the items and with the OnChange from the Toggle use this filter below?

 

Filter(TestPowerApps, If(Toggle2.Value = true, Status.Value="Error")) 
Filter(TestPowerApps, If(Toggle1.Value = true, Paid =true)

 

 

Column paid = yes/no

Column status = choice column

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User II
Super User II

Say toggle1 sets variable1 to true (or false) and toggle2 sets variable2 to true (or false).

Now set the items property of your gallery to:

Filter(TestPowerApps, !Toggle2.Value = true || Status.Value="Error", !Toggle1.Value = true || Paid =true)

Let me know if this works.


---
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

View solution in original post

3 REPLIES 3
PowerAddict
Super User II
Super User II

Say toggle1 sets variable1 to true (or false) and toggle2 sets variable2 to true (or false).

Now set the items property of your gallery to:

Filter(TestPowerApps, !Toggle2.Value = true || Status.Value="Error", !Toggle1.Value = true || Paid =true)

Let me know if this works.


---
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

View solution in original post

**bleep**, i was so close 🙂 I only changed the last item to 

Filter(TestPowerApps, !Toggle2.Value = true || Status.Value="Error", !Toggle1.Value = true || Paid =1)

Paid=1 because true or false doenst work very well with yes/no column. I found this blog about this issue https://rezadorrani.com/index.php/2019/04/14/powerapps-filter-sharepoint-yes-no-column-bug/

 

@PowerAddict Thanks! 
 

Glad I could help! Good luck with the rest of your app! Feel free to reach out in case of any questions!

Thanks,
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (66,044)