Greetings!
I am having some trouble trying to make a sortable gallery . . . I have a header on the column that that will change a variable to alter the sort column and sort order for each column, for it's gallery bellow. However with the current formulas I'm using, it's causing me delegation errors, which I am not able to solve on my own for now . . . Here's as much as info as I can give on the situation!
What I'm trying to do

Column OnSelect Property (Changing "EID" for other values on each column)
If(
varSort <> "EID";
UpdateContext(
{
varSort: "EID";
varSortOrder: "None"
}
)
);;
If(
varSortOrder = SortOrder.Ascending;
UpdateContext({varSortOrder: SortOrder.Descending});
varSortOrder = SortOrder.Descending;
UpdateContext({varSortOrder: "None"});
varSortOrder = "None";
UpdateContext({varSortOrder: SortOrder.Ascending})
)
Galler Items property
Sort(
Filter(
Search(
'TableGE - Employees';
compUltimateTextbox_1.value;
EMPLOYEE_NAME
);
Or(
IsBlank(compUltimateCombobox_1.selectedItems);
EMPLOYEE_RESPONSIBLE.RESPONSIBLE_NAME in ShowColumns(
compUltimateCombobox_1.selectedItems;
Value
)
)
);
Switch(
varSort;
"EID";
EMPLOYEE_ID;
"ENAME";
EMPLOYEE_NAME;
"ERESPONSIBLE";
EMPLOYEE_RESPONSIBLE.RESPONSIBLE_NAME
);
Switch(
varSortOrder;
"ascending";
SortOrder.Ascending;
"descending";
SortOrder.Descending;
"None";
"None"
)
)
Non-delegable part of the gallery code

If there is any other way to achieve what I'm doing while retaining the delegation, or any code-fix I can implement on this, I'll be very thankful . . . For now I'll keep trying to fix it on my own, but a little help never hurts!