Hi,
I am trying to have dynamic sorting, with complex types which is why SortByColumn() is not working.
My code basically is this:
Sort('Data';
Switch(lastSortFilter;
"xy";'xy.DisplayName;
"ID"; ID;
"Title";Title;
"Status";Status.Value;
"abc";'abc'.Value;
)
; If(SortVar; Descending; Ascending))
The problem is, it is only working as text sort an breaks the sorting of the number columns. For Example ID gets sortet like this:
| 1 |
| 10 |
| 11 |
2 |
But ID is not a text column. If I change my Code to this:
Sort('Data';
ID
; If(SortVar; Descending; Ascending))
It sorts the way it should be. So 1, 2, [...], 10, 11.
So why is the Switch() function breaking the sort function and is there any workaround?
Thanks for any help

Report
All responses (
Answers (