<?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: Concat Sort-Weight not working with string Columns in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823875#M1213807</link>
    <description>&lt;P&gt;Why not using always numeric values - adjusted within the script, maybe like:&lt;/P&gt;&lt;P&gt;dual(strength, keepchar(strength, '0123456789')) as&amp;nbsp;strength&lt;/P&gt;&lt;P&gt;and then using them directly as sorting within the concat() without the aggr() and also the same sorting for all the different concat() and maybe a distinct statement to exclude duplicates.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jul 2021 12:16:07 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2021-07-22T12:16:07Z</dc:date>
    <item>
      <title>Concat Sort-Weight not working with string Columns</title>
      <link>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823431#M1213779</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a trouble in using sort-weight in QlikView Concat function in pivot table expression.&lt;BR /&gt;Input:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Code&lt;/TD&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;strength&lt;/TD&gt;&lt;TD&gt;REC_Num&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ID1&lt;/TD&gt;&lt;TD&gt;AA11&lt;/TD&gt;&lt;TD&gt;Item1&lt;/TD&gt;&lt;TD&gt;20mg&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;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&lt;/P&gt;&lt;P&gt;Expected Output:&lt;/P&gt;&lt;P&gt;Dimension - ID, Code&lt;/P&gt;&lt;P&gt;Expressions - Item, Strength&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Code&lt;/TD&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;Strength&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;AA11&lt;/TD&gt;&lt;TD&gt;Item1&lt;/TD&gt;&lt;TD&gt;20mg&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;BB11&lt;/TD&gt;&lt;TD&gt;Item2,Item3,Item4&lt;/TD&gt;&lt;TD&gt;30mg, 500mg, 10mg&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for some reason, this isn't working.&lt;/P&gt;&lt;P&gt;Concat(Strength, ',', Aggr(Rank(REC_Num),Code,Item))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The order of concat should be same in Item and Strength expressions.&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 13:28:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823431#M1213779</guid>
      <dc:creator>manideep78</dc:creator>
      <dc:date>2021-07-21T13:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Sort-Weight not working with string Columns</title>
      <link>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823669#M1213790</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Hi All,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;can you please suggest any ideas? I appreciate your time.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 15:05:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823669#M1213790</guid>
      <dc:creator>manideep78</dc:creator>
      <dc:date>2021-07-21T15:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Sort-Weight not working with string Columns</title>
      <link>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823875#M1213807</link>
      <description>&lt;P&gt;Why not using always numeric values - adjusted within the script, maybe like:&lt;/P&gt;&lt;P&gt;dual(strength, keepchar(strength, '0123456789')) as&amp;nbsp;strength&lt;/P&gt;&lt;P&gt;and then using them directly as sorting within the concat() without the aggr() and also the same sorting for all the different concat() and maybe a distinct statement to exclude duplicates.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 12:16:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823875#M1213807</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-07-22T12:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Sort-Weight not working with string Columns</title>
      <link>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823961#M1213813</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your response. I appreciate it&lt;/P&gt;&lt;P&gt;I thought I will give a try in chart function but it didn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, there is no guarantee that Strength column is always alphanumeric. It could be&amp;nbsp; just string of alphabets.&lt;/P&gt;&lt;P&gt;So, I created a as sort key(autonumber) in script&amp;nbsp; and used it in concat chart function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;table1:
LOAD * INLINE [
    ID, Code, Item, Strength, RecNum
    ID1, AA11, Item1, 20mg, 101
    ID1, AA11, Item1, 20mg, 102
    ID1, BB11, Item3, 500mg, 100
    ID1, BB11, Item3, 500mg, 99
    ID1, BB11, Item4, 10mg, 103
    ID1, BB11, Item4, 10mg, 104
    ID1, BB11, Item2, 30mg, 98
    ID1, BB11, Item2, 30mg, 105
];


table2:

LOAD *,
AutoNumberHash128(Item,Strength)as sortkey 
Resident table1
order by Item;


DROP table  table1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Concat Expression:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=Concat(DISTINCT Strength,',', sortkey)&lt;/P&gt;&lt;P&gt;I'm not sure if this is&amp;nbsp; the optimal solution but it worked for me.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 15:55:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Concat-Sort-Weight-not-working-with-string-Columns/m-p/1823961#M1213813</guid>
      <dc:creator>manideep78</dc:creator>
      <dc:date>2021-07-22T15:55:54Z</dc:date>
    </item>
  </channel>
</rss>

