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!
Solved! Go to Solution.
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:
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,
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?
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.
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:
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,
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.
Im getting circular reference error when i place the code on within my combobox.
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)
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.
User | Count |
---|---|
134 | |
131 | |
97 | |
77 | |
74 |
User | Count |
---|---|
206 | |
197 | |
69 | |
59 | |
52 |