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

Hide/Show ComboBox items

Hi Guys,

 

Need your expertise on this matter, i have a combobox thats not link to any sharepoints.

 

My issue here, I like to hide certain items within the combobox. Example: there is 4 options : None, Item 1, Item 2, Item 3.

 

When user selected "None", I want Item 1, Item 2 and Item 3 to be hide. Same goes with other option, If Item1, Item 2 or Item 3 is selected, Hide "None". Take note that this is multiple selection comboBox. 

 

Any kind heart can assist me on this.

 

Cheers! 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Haki500 ,

What you are doing is quite unusual and this is a workaround, but try

UpdateContext(
   {
      varDD: 
      If(
         Self.Selected.Value = "None",
         ["None"],
         Len(Self.Selected.Value) > 0,
         [
            "Option 1",
            "Option 2",
            "Option 3"
         ],
         [
            "None",
            "Option 1",
            "Option 2",
            "Option 3"
         ]
      )
   }
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

9 REPLIES 9
WarrenBelz
Super User
Super User

Hi @Haki500 ,

On the OnVisible of your screen - whatever choices are there

UpdateContext(
   {
      varDD: 
      [
         "None",
         "Option 1",
         "Option 2",
         "Option 3"
      ]
   }
)

Items of your Combo Box

varDD

OnChange of your Combo Box

If(
    Self.Selected.Value = "None",
    UpdateContext({varDD: ["None"]})
)

You might also need a reset button/icon with the same code as Screen OnVisible

 

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.

Visit my blog Practical Power Apps

 

Haki500
Frequent Visitor

Hi @WarrenBelz ,

 

Noted, let me try and get back to you. Appreciated your input on this.

 

Cheers!

 

 

Haki500
Frequent Visitor

Hi @WarrenBelz,

 

It work like charm for the first part!

 

But it still show "None" when other options is selected, Please advise.

Hi @Haki500 ,

What you are doing is quite unusual and this is a workaround, but try

UpdateContext(
   {
      varDD: 
      If(
         Self.Selected.Value = "None",
         ["None"],
         Len(Self.Selected.Value) > 0,
         [
            "Option 1",
            "Option 2",
            "Option 3"
         ],
         [
            "None",
            "Option 1",
            "Option 2",
            "Option 3"
         ]
      )
   }
)

 

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.

Visit my blog Practical Power Apps

Hi @WarrenBelz ,

 

Sorry for the unusual request, haha.

 

I have tried your formula but seem like  Self.Selected.Value giving me Error.

 

Please advise.

Hi @Haki500 ,

Ensure you have this OnChange on the Combo Box (and the Items are varDD) - I actually tested this due to the unusual nature

WarrenBelz_0-1660634514734.png

HideChoices.gif

 

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.

Visit my blog Practical Power Apps

 

Hi @WarrenBelz,

 

So i assumed that i need to made the changes "OnChange" and not "OnVisible" right?

Please advise.

HI @Haki500 ,

There are two pieces of code in the post - OnVisible of the Screen and OnChange of the Combo Box - the last code I supplied was for the second one.

 

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.

Visit my blog Practical Power Apps

Hi @WarrenBelz,

 

Finally its working!

Thanks!

 

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (4,128)