hello, i have an app with a gallery who shows items based on a searchbar text and a combo selected values.
1) i need that when the app starts, and the combobox is empty, the gallery should show all the items, like it's not filtering. how can i do that?
2) when i select one single value, the filter is correct, but when i select multiple values, it filter only the last item added. why?
this is my code:
sportsList is my combo, Sport is a choice column of my sharepoint.
Filter(
Search(
MyData,
SearchBar.Text,
"Username",
"LocationName",
"Location2"
),
sportsList.Selected.Value = Sport.Value
)
i figured i had to use SelectedItems.Value for multiple data, but if i use it it gives me an error, because it says it's impossible to compare a table with a text
how to fix?
thank you so much
Solved! Go to Solution.
Hi @Antonioclk ,
The below should do the trick for what you described: no filtering for Sport if nothing is selected:
Filter(
Search(
MyData,
SearchBar.Text,
"Username",
"LocationName",
"Location2"
),
If(
IsEmpty(sportsList.SelectedItems),
true,
Sport in sportsList.SelectedItems
)
)
For aesthetics you can change the IsSearchable and NoSelectionText properties of the sportsList ComboBox to ,respectively, false and "All" to make it look as if all items are selected when none are.
Hi @Antonioclk ,
The below should be of help. It uses an If loop to check if there's anything in the SearchBar and only applies the Search() if there is. The second part uses the in operator to check the multiselect. It is not delegable, so depending on your specifics you may want to look for an alternative:
Filter(
If(IsBlank(SearchBar.Text),true,
Search(
MyData,
SearchBar.Text,
"Username",
"LocationName",
"Location2"
)),
Sport in sportsList.SelectedItems
)
hello, thank you so much!
the Sport in sportsList.SelectedItems works! the other part (if(isblank(xx)) gives me error.
how should it work? why are you checking the blank in the search? maybe i didn't explain myself well.
the blank search already shows me all the items. what i'd like to do is that when the app is opened, the combobox is empty, and i would love for it to work as if it had all items selected... is that possible?
Hi @Antonioclk ,
In that case please remove the IsBlank() part:
Filter(
Search(
MyData,
SearchBar.Text,
"Username",
"LocationName",
"Location2"
),
Sport in sportsList.SelectedItems
)
To have all items in the sportsList combobox selected, set the DefaultSelectedItems property to match the code for the Items property, probably something like:
Choices(MyData.Sport)
is there a way to start the app with the combobox blank, notshowing anything... but the list filtered as if all items were selected? or to add an item "all" in the combobox and when "all" is selected, it consider all the items?
I don't like to see the combo so full right when the app is started, but at the same time i want to show all the items
Hi @Antonioclk ,
The below should do the trick for what you described: no filtering for Sport if nothing is selected:
Filter(
Search(
MyData,
SearchBar.Text,
"Username",
"LocationName",
"Location2"
),
If(
IsEmpty(sportsList.SelectedItems),
true,
Sport in sportsList.SelectedItems
)
)
For aesthetics you can change the IsSearchable and NoSelectionText properties of the sportsList ComboBox to ,respectively, false and "All" to make it look as if all items are selected when none are.
Great solution! thank you so much
User | Count |
---|---|
156 | |
94 | |
82 | |
77 | |
58 |
User | Count |
---|---|
196 | |
175 | |
103 | |
96 | |
89 |