- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sort a table using expressions
I want to use a Button to change the sorting of a table (no pivot-table).
Let's assume that I have 2 columns in the table: Col1 and Col2. If the Button is clicked, I want to change the value of a local variable 'vTableSort' from 'Col1' to 'Col2' and vice-versa. If 'vTableSort' has the value 'Col1', the table should be sorted ascending based on 'Col1'. If 'vTableSort' has the value 'Col2', the table should be sorted descending based on 'Col2'.
I would appreciate if anyone could help me out with this!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can u try like
If( variable='col1', 'col2', 'col1')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where am I supposed to write that? There is no "Sort by Expression" field for a table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In expression of Sort tab, use below
If( variable='col1', 'col2', 'col1')
another approach :
https://community.qlik.com/t5/New-to-Qlik-Sense/Custom-Sort/td-p/1666109
another approach :
https://community.qlik.com/t5/New-to-Qlik-Sense/Custom-sorting-of-Dimentions/td-p/1285062
https://community.qlik.com/t5/App-Development/Sort-by-expression-filter-box/m-p/1866419#M71527
hope this will help
Vikas
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey, thank you for your reply! I think that this is exactly what I want. However, I can't find an expression field in the sorting tab. Attached you find a screenshot of how it looks like for me. Maybe I misunderstood, where I have to make these changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'll need to drag up this column so it's the first in the sort tab, uncheck sort auto and check 'sort by expression' can use this expression:
If( variable='col1', 'col2', 'col1')
not sure for button but in pivot report you can do the same.
Vikas
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.