Conditional Grid Sorting in Web Designer

Hi all

I’m wondering if there is a way to insert conditional sorting criteria into the field “Sorting” of a Grid object in the Web Designer.

Let’s say I have a collection COLL whit some columns: column1, column2, column3.

Again, let’s say I have a variable Var that can switch from value 1, 2 , 3

What I’m trying to do is to write a Sorting condition like this:

If Var = 1 then Sorting = ‘column1, column2, column3’

If Val = 2 then Sorting = ‘column2, column 1, column3’

If Val = 3 then Sorting = ‘column3, column 1, column2’

In need to achieve this effect automatically and not manually triggered by user, acting on grid’s header.

Please, if someone has an idea, share with me.

Thanks in advance