
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to change sort order dynamically?
Hi,
There are many differenet ways to sort in Qlikview charts such as Y-Value, Text, Frequency, State, even Expression. The static sort can be easily done. My questions is how to make the sorting dynamic. I want to allow users to select sorting methods such as Y-value and Text in Qlikview by clicking a button. Is this doable?
Thanks
Longmatch
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can leverage the "Sort by Expression" option and compute a sort order based on user input. For example, create a button that uses the Set Variable action to toggle a variable "vSort_FieldName".
=if(vSort_FieldName='name','freq','name')
Then in the object you want to sort, you can use a Sort Expression like:
=if('$(vSort_FieldName)'='name'
,''
,count([someField]) // Sort by Freq
)
For an example of this, see the listboxes on the "QVD Fields" sheet in the attached.
-Rob


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can leverage the "Sort by Expression" option and compute a sort order based on user input. For example, create a button that uses the Set Variable action to toggle a variable "vSort_FieldName".
=if(vSort_FieldName='name','freq','name')
Then in the object you want to sort, you can use a Sort Expression like:
=if('$(vSort_FieldName)'='name'
,''
,count([someField]) // Sort by Freq
)
For an example of this, see the listboxes on the "QVD Fields" sheet in the attached.
-Rob

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure if this works but maybe you could create an island table with a field of all the different sorts you want.
Then in the expression sort use the Pick(Match(SortDimension,'Custom Sort 1', 'Custom Sort 2', etc),Custom Sort Equation1, Custom Sort Equation 2, etc)
Put the SortDimension Field in you application and users can select the customer sorts in the list box.
Edit: Use Rob's Solution
