cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marksmyth
Level: Powered On

Combo Box filtering gallery

Hello,

 

I'm having an issue with filtering a gallery with a combo box. I've unsuccesfully tried to resolve this issue all morning. Here's what's happening:

 

I have a combo box filtering a gallery. I have an if statement for the gallery Items that states if the combo box is empty, show the entire table. If something is selected then filter the gallery accordingly. Something like this:

 

Items=If(IsEmpty(ComboBox.SelectedItems.Column) ,table , Filter(table,Column in ComboBox.SelectedItems.Column))

 

The issue is when I navigate to the screen, the gallery shows up empty, whereas it should be showing all items since there is no selected item in the combobox. As soon as I select an item from the combobox, and the remove it from the combobox, the gallery shows all records (as it should). 

 

I've tried setting the combobox DefaultSelectedItems = [ ], DefaultSelectedItems = Blank(), Default = Blank(), but all that didn't work. 

 

Any ideas?

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Combo Box filtering gallery

Hi @marksmyth ,

Based on the issue that you mentioned, I have made a test on my side based on your formula, the issue is confirmed on my side.

I think this issue may be related to the IsEmpty() function within your formula. The IsEmpty(ComboBox.SelectedItems) formula would return false continuously, regardless of whether the Combo Box is empty. So you could not use IsEmpty() function to detect if the Combo Box is empty.

As an alternative solution, I have made a test on my side, please take a try with the following workaround:10.JPG

Set the Items property of the Combo Box to following:

If(
IsBlank(ComboBox2.Selected.Value),
'20190211_case5',
Filter('20190211_case5', 'Account Coordinator'.Value in ComboBox2.SelectedItems.Value)
)

On your side, you should type:

If(
IsBlank(ComboBox.Selected.Column), /* <-- Modify formula here */
table,
Filter(table,Column in ComboBox.SelectedItems.Column)
)

Or

If(
   IsBlank(ComboBox.Selected), /* <-- Modify formula here */
   table, 
   Filter(table,Column in ComboBox.SelectedItems.Column)
)

Or

If(
   IsBlank(ComboBox.Selected.Value), /* <-- Modify formula here */
   table, 
   Filter(table,Column in ComboBox.SelectedItems.Column)
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: Combo Box filtering gallery

If(IsEmpty(ComboBox.SelectedItems.Column) ,table , Filter(table,Column in ComboBox.SelectedItems.Column))

Can you try eliminating the drill down into .Column? Since ComboBox.SelectedItems is already a table, you would not need to drill down to check if it is empty or not.

 

You also need the DefaultSelectedItems to have the exact same column structure as the Items of the ComboBox. Can you check that they indeed line up?

marksmyth
Level: Powered On

Re: Combo Box filtering gallery

I eleminated the drill down - all good.

 

I tried making DefaultSelectedItems the exact same as the Items. However when I do so what happens is that when navigating to the screen all items in the combo box get selected, which is what I need, but then I need to unselect them one at a time to remove them, hence this is why I used the If(IsEmpty(... formula for the gallery.  

 

When I leave the DefaultSelectedItems blank, I navigate to the screen and the combo box is empty, which is what I want, however it seems the gallery is still filtering for the items in the combo box and finds nothing, therefore the gallery is empty. 

Highlighted
Community Support Team
Community Support Team

Re: Combo Box filtering gallery

Hi @marksmyth ,

Based on the issue that you mentioned, I have made a test on my side based on your formula, the issue is confirmed on my side.

I think this issue may be related to the IsEmpty() function within your formula. The IsEmpty(ComboBox.SelectedItems) formula would return false continuously, regardless of whether the Combo Box is empty. So you could not use IsEmpty() function to detect if the Combo Box is empty.

As an alternative solution, I have made a test on my side, please take a try with the following workaround:10.JPG

Set the Items property of the Combo Box to following:

If(
IsBlank(ComboBox2.Selected.Value),
'20190211_case5',
Filter('20190211_case5', 'Account Coordinator'.Value in ComboBox2.SelectedItems.Value)
)

On your side, you should type:

If(
IsBlank(ComboBox.Selected.Column), /* <-- Modify formula here */
table,
Filter(table,Column in ComboBox.SelectedItems.Column)
)

Or

If(
   IsBlank(ComboBox.Selected), /* <-- Modify formula here */
   table, 
   Filter(table,Column in ComboBox.SelectedItems.Column)
)

Or

If(
   IsBlank(ComboBox.Selected.Value), /* <-- Modify formula here */
   table, 
   Filter(table,Column in ComboBox.SelectedItems.Column)
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

nizam1011
Level: Powered On

Re: Combo Box filtering gallery

May be this is a stupid qustion. 
I am not a programmer. I see videos and answers in this community to make apps I need.


Question:
Is there a way for

Filter(table,Column in ComboBox.SelectedItems.Column)

to filter for exact match?
I have a lot of similar values. It picks up all of them.

Attched a sample list of items in the column I am trying to filter. The start of all is similar.

Kenneth
Level: Powered On

Re: Combo Box filtering gallery

Im getting circular reference error when i place the code on within my combobox.

PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: Combo Box filtering gallery

@nizam1011,

To get exact matches, you can use the exactin operator. It works exactly as 'in' does except that it looks for exact matches as its name entails.

 

Something like this should work:

Filter(table,Column exactin ComboBox.SelectedItems.Column)

 

PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: Combo Box filtering gallery

@Kenneth,

Can you share more about what you're copy pasting and the exact error you're getting? If this is a very different context than the OPs, it is helpful to start a new thread so your post is distinguished.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 302 members 2,465 guests
Please welcome our newest community members: