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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set Variable When Comb...
Power Apps
Unanswered

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard