Hi @Anonymous :
Do you want to sort the records based on the two IconSort buttons?
Do you want to implement the following functions:
- Default: The records will be sorted by "ID" .
- Select Button1: The records will be sorted by "Date" .
- Select Button2: The records will be sorted by "ID" .
I think the solution mentioned by @eka24 can solve your problem. I have reorganized it for you.
Step1:add a button(Date) and set it’s Onselect property to:
UpdateContext({DateSort:!DateSort}); /* “DateSort” is a custom environment variable that can be changed to “true” or “false”*/
UpdateContext({LastSort: "Y"}) /* “LastSort” is a custom environment variable. The value of “LastSort” is used to be a analyzing conditions of the If() function */
Step2: add a button(ID) and set it’s Onselect property to:
UpdateContext({IDSort: !IDSort});
UpdateContext({LastSort: "N"})
Step3: add a gallery and set it’s items property to:
If(
LastSort = "Y",
Sort(
Test1, /*use your data source here*/
MYDATE, /*use your field name ”Date” here*/
If(
DateSort,
Descending,
Ascending
)
),
Sort(
Test1, /*use your data source here*/
MYID, /*use your field name ”ID” here*/
If(
IDSort,
Descending,
Ascending
)
)
)

Beat Regards,
Bof