
I have a gallery with the Item property SortByColumns(Filter([@'Source'], StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))
Inside the source, I have a column of data with items 0,1,2
I'm planning to have 3 buttons
if a user press 0 button, it will filter the gallery with items = 0
if a user press 1 button, it will filter the gallery with Items = 1
if a user press 2 button, it will filter the gallery with Items = 2
You can define a context variable that holds the value of the filter managed by your buttons:
In each button OnSelect callback (here for button 0):
UpdateContext({myFilter:0})
Then update the filter in your gallery:
SortByColumns(
Filter([@'Source'],
StartsWith(Title, TextSearchBox1.Text),
Or(myFilter<0,theColumnToFilter=myFilter)),
"Title", If(SortDescending1, Descending, Ascending))
And don't forget to initialize the filter value (in screen onVisible callback):
UpdateContext({myFilter:-1})