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 / How do you set up comb...
Power Apps
Unanswered

How do you set up combo boxes so that only one combo box can have a value in it at a time?

(0) ShareShare
ReportReport
Posted on by 831 Moderator

I have a series of combo boxes that filter a dataset. In many cases having more than one of the combo boxes with a selection will yield no record matches. My thought is that when on of the combo boxes is selected the others could be reset. Problem is if each is looking at the other for a change the Reset is triggered for all of them.

 

Simple Example

ComboBox1 resets ComboBox2 if a selection is made in ComboBox1.

ComboBox2 resets ComboBox1 if a selection is made in ComboBox2 which triggers the OnChange of Combox1 which resets ComboBox2

 

How can I make this work? I think setting a variable might be the answer but not sure how to implement.

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @futr_vision ,

    Make a text variable on box 2

    UpdateContext({varReset: "Reset1"})

    And the Reset property of box 1

    varReset = "Reset1"

    the do the opposite on the other one using “Reset2”

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • futr_vision Profile Picture
    831 Moderator on at

    Hi @WarrenBelz,

     

    Am I setting that variable at the OnChange property of combo box 2? 

     

    varReset = "Reset1" also gives me an incompatibility error.

     

    How would this work if I need to reset more than one control?

     

    I was thinking that maybe when a value in a control is chose then I can set a variable to a representation of that control. For example if I was working with ComboBox1 then I would set a variable to "ComboBox1". If I made a selection in ComboBox2 then I would change that variable to "ComboBox2". Then there would be some logic on each control that would check that variable and if the value was anything other than the value of the control then the combo box would be set to blank. Does that make sense?

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @futr_vision ,

    The only reason you would get a compatibility error is if you are using varReset somewhere else  with a different data type. You can call the Variable whatever you want, but the idea of Text variable is that you can change it to different values and when it is changed to the value that the particular control has as its Reset trigger, that control will reset. So OnChange of each control, you can set the Variable to the Reset trigger of the other.

  • futr_vision Profile Picture
    831 Moderator on at

    @WarrenBelz 

    Thanks. I did find that issue and removed it. Looks like your solution works but I run into issues with the reset if I need to account for more than one control. For example, I tried something like this on the Reset of CoboBox1

     

    Or(varReset = "Reset1", varReset = "Reset2")

     

     and

     

    varReset = "Reset1" || varReset = "Reset2"

     

    Neither of these throw and error but neither work. I'm not exactly sure why. I've thrown a label into the app to make sure that the variable was being set with the OnChange event of each control.

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @futr_vision ,

    Reset is triggered on a change of variable from something that is not the trigger to a value that is. So before each reset, set it to Blank() or any other value.

    UpdateContext({varReset: Blank()});
    UpdateContext({varReset: Reset1})

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • futr_vision Profile Picture
    831 Moderator on at

    @WarrenBelz ,

     

    I think my issue was using OnChange and not OnSelect. If I update the variable OnChange then it creates a loop and resets the combo box I just changed. I updated the variable without setting it to Blank(). It works.

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