<?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 Inconsistent results with SortByNumeric - it toggles ascending/descending in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Inconsistent-results-with-SortByNumeric-it-toggles-ascending/m-p/257775#M581592</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following subroutine, that seemed to be working fine with v8.5, but now seems to be toggling instead of consistantly setting the sort in ascending order.&amp;nbsp; The subroutine is as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;SUB TableChartSortNumericAscending&amp;nbsp; (SheetName, ObjectName, ColumnNumber)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.Sheets(SheetName).SheetObjects(ObjectName).Restore&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetApplication.WaitForIdle 3000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.Sheets(SheetName).SheetObjects(ObjectName).SortBy ColumnNumber&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetApplication.WaitForIdle 3000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set TableChart=ActiveDocument.GetSheetObject(ObjectName)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set Prop = TableChart.GetProperties&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if TableChart.GetObjectType=4 then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Its a Table&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prop.Layout.ColLayouts.Item(ColumnNumber).SortCriteria.SortByNumeric = 1&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set vars = Prop.Dimensions&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vars.Item(ColumnNumber).SortCriteria.SortByNumeric = 1&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetApplication.WaitForIdle 3000&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TableChart.SetProperties Prop&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;END SUB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does pretty much as it says:&amp;nbsp; Sets a column in a table or chart to sort numerically in ascending order.&amp;nbsp; Well, it used to.&amp;nbsp; Now when I run it, if the column is currently set to ascending, after running the macro, it will be set to descending.&amp;nbsp; If it was set to discending before running the macro, it will then be set to ascending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want this macro to *always* set the column to ascending, regardless what it's currently set to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jan 2012 21:59:17 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-01-06T21:59:17Z</dc:date>
    <item>
      <title>Inconsistent results with SortByNumeric - it toggles ascending/descending</title>
      <link>https://community.qlik.com/t5/QlikView/Inconsistent-results-with-SortByNumeric-it-toggles-ascending/m-p/257775#M581592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following subroutine, that seemed to be working fine with v8.5, but now seems to be toggling instead of consistantly setting the sort in ascending order.&amp;nbsp; The subroutine is as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;SUB TableChartSortNumericAscending&amp;nbsp; (SheetName, ObjectName, ColumnNumber)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.Sheets(SheetName).SheetObjects(ObjectName).Restore&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetApplication.WaitForIdle 3000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.Sheets(SheetName).SheetObjects(ObjectName).SortBy ColumnNumber&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetApplication.WaitForIdle 3000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set TableChart=ActiveDocument.GetSheetObject(ObjectName)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set Prop = TableChart.GetProperties&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if TableChart.GetObjectType=4 then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Its a Table&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prop.Layout.ColLayouts.Item(ColumnNumber).SortCriteria.SortByNumeric = 1&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set vars = Prop.Dimensions&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vars.Item(ColumnNumber).SortCriteria.SortByNumeric = 1&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetApplication.WaitForIdle 3000&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TableChart.SetProperties Prop&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;END SUB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does pretty much as it says:&amp;nbsp; Sets a column in a table or chart to sort numerically in ascending order.&amp;nbsp; Well, it used to.&amp;nbsp; Now when I run it, if the column is currently set to ascending, after running the macro, it will be set to descending.&amp;nbsp; If it was set to discending before running the macro, it will then be set to ascending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want this macro to *always* set the column to ascending, regardless what it's currently set to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 21:59:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inconsistent-results-with-SortByNumeric-it-toggles-ascending/m-p/257775#M581592</guid>
      <dc:creator />
      <dc:date>2012-01-06T21:59:17Z</dc:date>
    </item>
    <item>
      <title>Inconsistent results with SortByNumeric - it toggles ascending/descending</title>
      <link>https://community.qlik.com/t5/QlikView/Inconsistent-results-with-SortByNumeric-it-toggles-ascending/m-p/257776#M581593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I discovered the numbers of the fields changed.&amp;nbsp; It used to be that the field numbers were by visible fields.&amp;nbsp; It now appears that the SortByNumeric is by the actual column number, regardless if it displays or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All working, now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2012 21:31:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inconsistent-results-with-SortByNumeric-it-toggles-ascending/m-p/257776#M581593</guid>
      <dc:creator />
      <dc:date>2012-01-24T21:31:14Z</dc:date>
    </item>
  </channel>
</rss>

