
Announcements
Hello:
I have a gallery with 'multiselect' sorting capabilities :
The arrows change the value of the VarColoumn variable and dictate on which column the gallery will be sorted as per this tutorial . Now everything works apart from Task Status column, which is choice column. How would I pass the values from icon 'on-select' to gallery items property, and sort the gallery by choice field? I am suppling code for Gallery items and for the 'sorting icon'(this code works on all fields apart from 'Task Status" choice column). Please note that the Search function is imbedded in the Sortybycoloumn as there is a (functional)search control.
Code for Gallery filter: * please note that I have appended column for choice
SortByColumns(
If(
!IsBlank(Search_tb.Text),
Search(
AddColumns(
ActiveLAFRequests,
"StatTask",
'Task Status'.Value
),
Search_tb.Text,
"Title",
"Brand",
"Varietal_x0028_s_x0029_",
"Vintage",
"Fanciful",
"AVA_x002f_Appellation_x0028_s_x0",
"StatTask"
),
ActiveLAFRequests
),
VarSortColoumns, //varibales
VarSortDirection
)
Code for icon on choice column
Set(
VarSortColoumns,
"StatTask"
);
Set(
VarSortDirection,
If(
VarSortDirection = Ascending,
Descending,
Ascending
)
);:
The issue is that you are switching record schema in your Items property by using that If statement. It is not needed as if the Search Text is blank, then it will already return what you want.
Your Items property Formula for the Gallery should become:
SortByColumns(
Search(
AddColumns(ActiveLAFRequests,
"StatTask", 'Task Status'.Value
),
Search_tb.Text, "Title", "Brand", "Varietal_x0028_s_x0029_", "Vintage", "Fanciful", "AVA_x002f_Appellation_x0028_s_x0", "StatTask"
),
VarSortColoumns,
VarSortDirection
)
The Formulas you have on the Icon are fine.
I hope this is helpful for you.