Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting chart expressions via Macro

Hi,

I search the site and came across the following code


function SortWOA
set chart=ActiveDocument.GetSheetObject("CH02")
set Prop = chart.GetProperties
set vars = Prop.Dimensions
Prop.Dimensions(0).SortCriteria.SortByAscii = 0
Prop.Dimensions(0).SortCriteria.SortByExpression = 1
Prop.Dimensions(0).SortCriteria.Expression.v = "Sum(total4)"
chart.SetProperties Prop
end function


This is what I have in my Straight Table/Chart:

Dimensions:
- Dimension called Shoes

Expressions:
- Expression1 = sum(total1)
- Expression2 = sum(total2)
- Expression3 = sum(total3)
- Expression4 = sum(total4)
- Expression5 = sum(total5)
- Expression6 = sum(total6)

I am hoping to use the above code as a button macro so when excute, it'll simply sort based on what I define in

Prop.Dimensions(0).SortCriteria.Expression.v = "Sum(total4)"
which will disregard Dimension (Shoes) alltogehter.

I think I am missing a code which actually capture the calculated expression that I want to sorty by.

Thank you for your time.

0 Replies