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 / Set Variable When Comb...
Power Apps
Answered

Set Variable When Combo box item is deselected?

(0) ShareShare
ReportReport
Posted on by

I am able to change the visibility of forms by setting the variable of Visible to true when an item is selected with my combo box, but I want to set it back to false when I deselect the item (its a single select combo box). I have this in the OnChange property:

 

If(!IsBlank(ReturningVisitorsBox.SelectedItems), Set(aVis, true), Set(aVis, false))
 
It's not setting back to false with this, is there somewhere else I need to put this in?
Categories:
I have the same question (0)
  • kelseytran Profile Picture
    292 on at

    Hi @PatrickMcLeanGL ,

     

    That code looks correct for the OnChange property, but that will only fire when the selected item changes, not when the selection is cleared.  Try keeping your code on the OnChange property, but add this to the OnSelect property of the control that clears the selection to reset the visibility variable:

    OnSelect:
     Set(aVis, false);
     Reset(ReturningVisitorsBox)

    ------------------------------------------------------------------------------------------------------------------------------
    If I answered your question, please accept my post as a solution and if you liked my response, please give it a thumbs up.

    Thanks!

  • Verified answer
    bengo83 Profile Picture
    159 on at

    Hi PatrickMcLeanGL

     

    Here is the code to set the variable:

    Set(aVis,CountRows(ComboBox1.SelectedItems)>0)
    I hope it helps 🙂
     
    Best regards
    Beny
     
     
  • PatrickMcLeanGL Profile Picture
    on at

    Worked perfectly thank you!

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 325 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard