Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort Table By Specified Column Selection

I'm trying to sort a Straight Table by, depending on the user column selection.

If possible, I would like to do so via a macro, as the same user selection will be applied to several charts (easier to copy to the other charts).

The user can select 1 of 3 criteria, which is stored in a variable 'Order_By'.

Then I tried using the macro below:

     Sub Order_By

     If ActiveDocument.Variables("Order_By").GetContent.String = "SIR No" Then

         ActiveDocument.GetSheetObject("Table_All").SortBy 1

     Else

         If ActiveDocument.Variables("Order_By").GetContent.String = "Application" Then

             ActiveDocument.GetSheetObject("Table_All").SortBy 3

         Else

             If ActiveDocument.Variables("Order_By").GetContent.String = "Status" Then

                 ActiveDocument.GetSheetObject("Table_All").SortBy 33

             End If

         End If

     End If

     End Sub

This doesn't fully work.

Also it seems to mess up the 'Sort By Columns Priority', if I take a look at the chart properties.

How can achieve a simple sort by a specified column ?

Thanks

10 Replies
acandido84
Creator
Creator

Hello Rebecca . I'm trying to run what do you showed in the example ... I need to sort the columns Cause value and value payment is made .. can help me ...