web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to use a button to...
Power Apps
Answered

How to use a button to set and then unset a variable (i.e. filter a list, and then unfilter)

(0) ShareShare
ReportReport
Posted on by 549

I'm wondering if someone can help me with a functionality I want on a button!

 

I want the user to be able to press a button to filter a list based on status DRAFT.  So I've OnSelect to Set(varDraft, true). And my Gallery Items to:

If(
varDraft = true,
SortByColumns(
Filter('Information',Status.Value = "Draft"),"Created",Descending),
etc.

 

So far so good!

 

But what I want to happen, is once they've pressed the button to filter the list, I'd like the button to look like it's pressed down and when they click again (to effectively "pop" the button back) and Set(varDraft, false) and go back to looking "normal".

 

Any ideas??

Categories:
I have the same question (0)
  • Verified answer
    BCBuizer Profile Picture
    22,833 Super User 2026 Season 2 on at

    Hi @RMD211 ,

     

    Change the OnSelect property of the button to:

     

    Set(varDraft, !varDraft)
  • RM-30040732-0 Profile Picture
    549 on at

    So simple!! Thanks very much!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 400 Most Valuable Professional

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard