Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Detect current sort order of table

Does anybody have any macro code that will allow me to detect the current column on a straight table that is sorted, and in what direction (ascending/descending) that its sorted by?

1 Reply
Not applicable
Author

Nigel,

Part I - the sorted column.
Hth,
Thilo

PS: I tool the code from the API Guide Sample for 'InterFieldSortOrder' ... which has a slight bug in lbound and ubound.

Sub SortInfo
set chart = ActiveDocument.GetSheetObject("CH01")
cols = chart.GetProperties.TableProperties.InterFieldSortOrder

msgbox "Sorted Column = " & CStr(cols(lbound(cols))+1)
end sub


' Modified Sample from API Guide
sub SI
set chart = ActiveDocument.GetSheetObject("CH01")
cols = chart.GetProperties.TableProperties.InterFieldSortOrder

for i = lbound(cols) to ubound(cols)
msgbox("sort priority " & i+1 & " for column " & cols(i)+1 )
next
end sub