cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Future_Vision
Responsive Resident
Responsive Resident

How do I make a combo box value conditional on previous combo box value?

Future_Vision_0-1617977690220.png

 

I am working with 3 combox boxes as you can see above. Each proceeding combo box becomes editable if the previous combo box is not blank. Like this:

 

If(!IsBlank(Brand1_CB.Selected), DisplayMode.Edit,DisplayMode.Disabled)

 

Now, this works great with one exception. Each combo box is searchable so I can choose an option for Brand1 and an option for Brand2 then go back and delete the option in Brand1. This disables Brand2 but the value is still there. What I need to be able to do is remove/reset the combo box value to blank if the proceeding combo box value is blank. Not quite sure how to do this. I'm thinking and if statement but which property and what are the correct arguments?

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User III
Super User III

@Future_Vision 

You can achieve this through the DefaultSelectedItems (DSI) property of the combobox.

If you already have a formula in that property then:

   If(Self.DisplayMode=DisplayMode.Edit, yourExistingDSIproperty, Blank())

 

If not, then:

   If(!(Self.DisplayMode=DisplayMode.Edit), Blank())

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

RandyHayes
Super User III
Super User III

@Future_Vision 

Oops, sorry...I meant:

If(!(Self.DisplayMode=DisplayMode.Edit), [ ])

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

5 REPLIES 5
RandyHayes
Super User III
Super User III

@Future_Vision 

You can achieve this through the DefaultSelectedItems (DSI) property of the combobox.

If you already have a formula in that property then:

   If(Self.DisplayMode=DisplayMode.Edit, yourExistingDSIproperty, Blank())

 

If not, then:

   If(!(Self.DisplayMode=DisplayMode.Edit), Blank())

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Hmmm. I'm trying this on my second combobox, Brand2. I don't have a formula in DSI. When I enter that second formula I get an error. 'Invalid argument type. Cannot use _Min values in this context.'

RandyHayes
Super User III
Super User III

@Future_Vision 

Oops, sorry...I meant:

If(!(Self.DisplayMode=DisplayMode.Edit), [ ])

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

@RandyHayes I discovered a small issue with this solution as it pertains to editing a record. Event though the field is set to blank because it is not active it does not overwrite any values already in the record. For example(see image below) I can add a record with the 3 brands. If I edit the record and delete the second or 2nd brand and save it only the second brand is overwritten. The 3rd brand remains unchanged even though it should remain blank. I'll open a new post if that is the best place to answer this.

 

Future_Vision_0-1619634930814.png

 

RandyHayes
Super User III
Super User III

@Future_Vision 

This is my odd rotation of responding to posts....I already responded to the other post, just now getting to older posts.  I usually do new posts first then responses.

Hopefully the solution in the other post is what you are looking for.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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 (44,977)