<?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 Re: Defining a Sort Order in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778341#M275890</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First create an inline load apply map:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lookup_GroupSort: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Mapping&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;INLINE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[&lt;BR /&gt; Desc, Num&lt;BR /&gt; ME1410, 1&lt;BR /&gt; ME1411, 2&lt;BR /&gt; 191114, 3&lt;BR /&gt;]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Then in your script where you pull in the field change the straight load to:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;dual(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dated&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;applymap&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;('Lookup_GroupSort', &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dated&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dated&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Nov 2014 12:10:02 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-11-19T12:10:02Z</dc:date>
    <item>
      <title>Defining a Sort Order</title>
      <link>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778338#M275887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a field called 'Dated' which has text in it, that I specify. i.e ME1410, ME1411 191114.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to be able to set that specific order of how its sorted. Is there a way to do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Di&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 11:45:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778338#M275887</guid>
      <dc:creator>dinicholls</dc:creator>
      <dc:date>2014-11-19T11:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a Sort Order</title>
      <link>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778339#M275888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you have a relatively small set of values, you could load the field as a dual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SortedTable:&lt;/P&gt;&lt;P&gt;LOAD dual(Text, SortOrder) as Text;&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;Text, SortOrder&lt;/P&gt;&lt;P&gt;ME1410, 1&lt;/P&gt;&lt;P&gt;ME1411, 2&lt;/P&gt;&lt;P&gt;191114, 3];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 11:49:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778339#M275888</guid>
      <dc:creator>marcus_malinow</dc:creator>
      <dc:date>2014-11-19T11:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a Sort Order</title>
      <link>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778340#M275889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try something like this in you sort expression.&lt;/P&gt;&lt;P&gt;Dual("Your Month Field",match("Your Month Field" ,'&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;ME1411&lt;/SPAN&gt;','&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;ME1410&lt;/SPAN&gt;','&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;ME1415&lt;/SPAN&gt;'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The your order the way you like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;ASHFAQ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 11:52:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778340#M275889</guid>
      <dc:creator>ashfaq_haseeb</dc:creator>
      <dc:date>2014-11-19T11:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a Sort Order</title>
      <link>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778341#M275890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First create an inline load apply map:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lookup_GroupSort: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Mapping&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;INLINE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[&lt;BR /&gt; Desc, Num&lt;BR /&gt; ME1410, 1&lt;BR /&gt; ME1411, 2&lt;BR /&gt; 191114, 3&lt;BR /&gt;]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Then in your script where you pull in the field change the straight load to:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;dual(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dated&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;applymap&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;('Lookup_GroupSort', &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dated&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dated&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 12:10:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778341#M275890</guid>
      <dc:creator />
      <dc:date>2014-11-19T12:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a Sort Order</title>
      <link>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778342#M275891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am assuming that the dates with ME denote month end and you have more than the examples in your post. You could construct it something like the below to get them correctly sorted&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set DateFormat = 'DD/MM/YYYY';&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Some way to get date range (may be based on fact table data or&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// some dynamic calculation)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vStart = Num(Date#('01/01/2013'));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vEnd = Num(Date#('31/12/2014'));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Normal master calendar construction&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Calendar:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD SequenceNo,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Date(SequenceNo) As Date,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Date(SequenceNo, 'DDMMYY') As Dated,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; If(SequenceNo = Floor(MonthEnd(SequenceNo)), 1, 0) As MonthEnd,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; // other calendar fields...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD $(vStart) + RecNo() - 1 As SequenceNo&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Autogenerate $(vEnd) - $(vStart) - 1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Now add the special ME codes&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Concatenate(Calendar)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD SequenceNo,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Date(SequenceNo) As Date,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Dual('ME' * Date(SequenceNo, 'YYMM'), SequenceNo) As &lt;EM&gt;Dated&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Calendar&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Where MonthEnd = 1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Optionally drop the MonthEnd flag&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//DROP FIELD MonthEnd;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may need to integrate the code into your existing master calendar and adapt the date range selection to your requirements. This assumes the the month end is the calendar month end - if it is not the same, you will need to adapt the calculation in the master calendar load to correctly flag the ME dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 12:26:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778342#M275891</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2014-11-19T12:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a Sort Order</title>
      <link>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778343#M275892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I didn't twig that you had Month End and date based values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If (Len(keepchar(Dated,'0123456789')=4,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dual(Dated, num(keepchar(Dated,'01234567890') &amp;amp; '00')),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dual(Dated, Dated)) as Dated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 12:32:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Defining-a-Sort-Order/m-p/778343#M275892</guid>
      <dc:creator>marcus_malinow</dc:creator>
      <dc:date>2014-11-19T12:32:52Z</dc:date>
    </item>
  </channel>
</rss>

