<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do you retrieve the sort order from a table? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-do-you-retrieve-the-sort-order-from-a-table/m-p/336515#M124116</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello:&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;I'm using the following script to retrieve the columns and sort order from an object, but how do I retrieve whether the column is being sorted ASC or DESC?&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Thanks.&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Richard&lt;/DIV&gt;&lt;DIV&gt;--------------------------------&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;set chart = ActiveDocument.GetSheetObject("CH01")&lt;BR /&gt; cols = chart.GetProperties.TableProperties.InterFieldSortOrder&lt;BR /&gt; output = ""&lt;BR /&gt; &lt;BR /&gt; for i = lbound(cols) to ubound(cols)&lt;BR /&gt; output = output + "sort priority " &amp;amp; i+1 &amp;amp; " for column " &amp;amp; cols(i)+1 &amp;amp; ",&amp;nbsp; " &amp;amp; i&lt;BR /&gt; next&lt;BR /&gt; &lt;BR /&gt; msgbox output &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Mar 2012 16:25:50 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-03-05T16:25:50Z</dc:date>
    <item>
      <title>How do you retrieve the sort order from a table?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-retrieve-the-sort-order-from-a-table/m-p/336515#M124116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello:&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;I'm using the following script to retrieve the columns and sort order from an object, but how do I retrieve whether the column is being sorted ASC or DESC?&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Thanks.&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Richard&lt;/DIV&gt;&lt;DIV&gt;--------------------------------&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;set chart = ActiveDocument.GetSheetObject("CH01")&lt;BR /&gt; cols = chart.GetProperties.TableProperties.InterFieldSortOrder&lt;BR /&gt; output = ""&lt;BR /&gt; &lt;BR /&gt; for i = lbound(cols) to ubound(cols)&lt;BR /&gt; output = output + "sort priority " &amp;amp; i+1 &amp;amp; " for column " &amp;amp; cols(i)+1 &amp;amp; ",&amp;nbsp; " &amp;amp; i&lt;BR /&gt; next&lt;BR /&gt; &lt;BR /&gt; msgbox output &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2012 16:25:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-retrieve-the-sort-order-from-a-table/m-p/336515#M124116</guid>
      <dc:creator />
      <dc:date>2012-03-05T16:25:50Z</dc:date>
    </item>
    <item>
      <title>How do you retrieve the sort order from a table?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-retrieve-the-sort-order-from-a-table/m-p/336516#M124117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Check with this.&lt;/P&gt;&lt;P&gt;set dimension = chart.GetProperties.Dimensions&lt;/P&gt;&lt;P&gt;msgbox &lt;STRONG&gt;dimension(0).SortCriteria.SortByAscii&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it shows 1 then sort done by asc. -1 means Desc.0 means sort is not done by Text(ABC).&lt;/P&gt;&lt;P&gt;For numeric use SortByNumeric instead of SortByAscii.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Celambarasan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2012 05:14:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-retrieve-the-sort-order-from-a-table/m-p/336516#M124117</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-03-06T05:14:45Z</dc:date>
    </item>
    <item>
      <title>How do you retrieve the sort order from a table?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-retrieve-the-sort-order-from-a-table/m-p/336517#M124118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Celambarasan:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While this retrieves the default sort order, it doesn't retrieve the current sorted order.&amp;nbsp; For example, using the code at the bottom of this message, values for 8 columns are retrieved with column 3 selected for sorting, as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3, 1, 2, 4, 5, 6, 7, 8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to be returned is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3 desc, 1 asc, 2 asc, 4 asc, 5 asc, 6 asc, 7 asc, 8 asc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The default sort order for all columns is asc, which is what .SortCriteria.SortByAscii returns.&amp;nbsp; However, if the user elects to sort it a different way through the interface (right click on column, select Sort) it overrides the default sort order.&amp;nbsp; It's that value I'm looking for. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are there any extensions off of the array -- something like cols(i).GetSortDirection?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, thanks for your help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;set chart = ActiveDocument.GetSheetObject("CH117")&lt;BR /&gt; cols = chart.GetProperties.TableProperties.InterFieldSortOrder&lt;BR /&gt; &lt;BR /&gt; for i = lbound(cols) to ubound(cols)&lt;BR /&gt; if i &amp;lt; ubound(cols) Then&lt;BR /&gt; output = output &amp;amp; cols(i)+1 &amp;amp; ", "&lt;BR /&gt; Else&lt;BR /&gt; output = output &amp;amp; cols(i)+1&lt;BR /&gt; End if&lt;BR /&gt; next&lt;BR /&gt; &lt;BR /&gt; msgbox output &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2012 15:26:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-retrieve-the-sort-order-from-a-table/m-p/336517#M124118</guid>
      <dc:creator />
      <dc:date>2012-03-06T15:26:15Z</dc:date>
    </item>
  </channel>
</rss>

