Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
pepe2209
Creator
Creator

sort by expression retrieved from input field

Hello.

I would like to achieve the following:

I've several buttons which adjust the expression in inputfield "vSort"

for example,

Button 1: change variable vSort, value: =only({1} Present)

Button 2: change variable vSort, value: etc.

Now i want to sort a table by expression, using as expression =vSort, but this does not work because vSort is already a calculated value of the expression: =only({1} Present) and not the expression itself.

So i would like to change the sorting easily by clicking the buttons (which can have some extensive expressions).

is this possible?

your help would be much appreciated,

regards

Peter

1 Solution

Accepted Solutions
northerner
Partner - Contributor III
Partner - Contributor III

Hi Peter,

Try this:

1) When you define the variable value in the button, don't use the'=' sign - i.e. instead of "=only({1} Present)" use "only({1} Present)"

2) Depending what is in the chart sort expression, you may then need to use a dollar expansion, i.e. =$(vSort)

Step 1 should store the expression text in the variable, rather than the expression result.  Step 2 will then give you the result of the expression (if required).

Hope this helps

View solution in original post

3 Replies
sujeetsingh
Master III
Master III

You need to define the Variable in another way.

northerner
Partner - Contributor III
Partner - Contributor III

Hi Peter,

Try this:

1) When you define the variable value in the button, don't use the'=' sign - i.e. instead of "=only({1} Present)" use "only({1} Present)"

2) Depending what is in the chart sort expression, you may then need to use a dollar expansion, i.e. =$(vSort)

Step 1 should store the expression text in the variable, rather than the expression result.  Step 2 will then give you the result of the expression (if required).

Hope this helps

pepe2209
Creator
Creator
Author

Yes this works for me,

Thanks!