cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jan_
Frequent Visitor

Conditional options in ComboBox

Hello All,

 

I am trying to limit the values of a multiselect combobox based on the selection of the same combobox:

  • Not Applicable
  • Option 1
  • Option 2
  • Option 3

Users should be able to select either 'Not Applicable' OR a combination of Option 1 to 3. It should not be possible to select for example Not Applicable + Option 2.

I have tried to user the "On Update" property as follows to at least colorcode the border if they select something wrong, but even this does not work:

If(First(DataCardValue13.SelectedItems).Value = "Not Applicable" || CountA(DataCardValue13.SelectedItems.Value) > 1 ,DataCardValue13.BorderColor = Red)

 

Options which I thought of: Reset the field if Not Applicable + something else would be selected or make the combobox single select in case Not Applicable would be selected.

 

Does anyone have a good idea?

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Jan_
Frequent Visitor

Hi All,

 

found the solution:

While for @rubin_boer apparently the following worked well:

SelectMultiple = Not("Not Applicable" in Self.SelectedItems)

For me it had to be as follow:

SelectMultiple = Not("Not Applicable" in Self.Selected.Value)

Issue is closed.

Thank you @rubin_boer for pointing me to the right direction.

BR Jan

View solution in original post

3 REPLIES 3
rubin_boer
Super User
Super User

hi @Jan_ 

set the comobox's SelectMultiple = Not("Not Applicable" in Self.SelectedItems)

disable not applicable and more.gif

Hope this helps,

R

Jan_
Frequent Visitor

Hi @rubin_boer ,

Thanks a lot for your quick response and for providing a solution.

It looks logical and seems to work as intended in your example but when I include the code in my PowerApp, it seems to not have any effect.

I have tried copying the exact text of the choice from the SharePoint list column configuration to ensure no spelling errors but it does not work - i am still able to select all options together.

Do you have any idea what else I can verify to achieve the same like you?

BR Jan

Jan_
Frequent Visitor

Hi All,

 

found the solution:

While for @rubin_boer apparently the following worked well:

SelectMultiple = Not("Not Applicable" in Self.SelectedItems)

For me it had to be as follow:

SelectMultiple = Not("Not Applicable" in Self.Selected.Value)

Issue is closed.

Thank you @rubin_boer for pointing me to the right direction.

BR Jan

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,316)