Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
bharani8
Creator III
Creator III

Sorting with Help of a Button

Hi Experts - I have a chart... Am trying to figure out whether we have an option like.. On click of an button, My dimension (which is sorted based on my expression) should change from Asc to Desc and vice versa...

Regards

Bharani

1 Solution

Accepted Solutions
sunny_talwar

Check the attached sample

View solution in original post

12 Replies
sunny_talwar

You can do that using a sort expression within your chart and a variable...Basically, based on a variable value, you can change the sort expression like this

If(vVar = 1, Sum(Measure), -Sum(Measure))

sunny_talwar

Check the attached sample

bharani8
Creator III
Creator III
Author

Wowwwww!! U r an Star!!   TY so much!!

bharani8
Creator III
Creator III
Author

Will try to incorporate in my DB and let u know how it goes ..

effinty2112
Master
Master

Hi Bharani,

                    I'd like to contribute something which works along with Sunny's solution.

Create a button with text : =if($(vVar) = 1,'Asc','Desc')

and give it the action to change the variable vVar to: =1-$(vVar)

Clicking this button will toggle the value of the variable between 1 and 0 and change the sort order in your chart.

Cheers

Andrew

bharani8
Creator III
Creator III
Author

TY Walker for taking your time to post this!!

I was not able click on that "Mark as Helpful" as it keeps on loading.. Any ways Thanks..

Mark as Helpful.PNG

sunny_talwar

Hey Andrew -

Where exactly do we add this expression? Can you update my sample to show how it would work?

Thanks,

Sunny

prieper
Master II
Master II

as action on click:

You only need to set vVar initially to either 0 or -1 ...

sunny_talwar

Where will this go?

=if($(vVar) = 1,'Asc','Desc')