<?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: Is there a way to control a text field's sort order globally without botching text alignment? in Visualization and Usability</title>
    <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692222#M162000</link>
    <description>&lt;P&gt;Sunny_talwar:&lt;/P&gt;&lt;P&gt;Thanks, your idea to use chr() got me thinking.&amp;nbsp; I don't like char(930) in particular because it just shows up as a rectangle for me, but there are other choices that are ok.&lt;/P&gt;&lt;P&gt;I ran this to see what options I had:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Chars:
LOAD
    RowNo() AS code,
    Chr(RowNo()) AS char,
    If(Chr(RowNo()) &amp;gt; 'z', 'Yes', 'No') AS isAfterZ
AutoGenerate 150000;&lt;/LI-CODE&gt;&lt;P&gt;The two ideas I came up with from that experiment are:&lt;/P&gt;&lt;P&gt;1) The Greek letter Nu, which looks identical to the ASCII letter N:&amp;nbsp;Chr(925) &amp;amp; 'ONE'&lt;/P&gt;&lt;P&gt;You end up with something that looks like NONE but sorts the way I want it, with NONE at the end.&amp;nbsp; The downside to this is that when people export the data, if they do a text search, they will be confused as to why they get no hits when they type NONE in Excel's find dialog.&amp;nbsp; I will have to teach them to copy and paste it instead of typing it.&lt;/P&gt;&lt;P&gt;2) One particular Unicode hyphen that Qlik treats as coming after Z, unlike the regular ASCII hyphen:&amp;nbsp;Chr(11451)&lt;/P&gt;&lt;P&gt;This has the same downside as #1 in that it will trick people into thinking it's a regular hyphen, but maybe it's slightly less insulting/annoying than a fake N.&amp;nbsp; I suppose I will go with this for now.&amp;nbsp;&amp;nbsp;Ultimately, I still consider this a hack and wish there were a better way, but what can you do?&lt;/P&gt;&lt;P&gt;The relevant parts of my code now look similar to this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Let blank = Chr(11451);
Set ReplaceBlanks = If(Len(Trim($1)), $1, '$(blank)');

Fruit:
LOAD *
INLINE [
    Fruit
    Apples
    Grapes
    Oranges
    $(blank)
];

SomeOtherTable:
LOAD
    $(ReplaceBlanks([Some Field])) AS [Some Field],
    ...
FROM ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Apr 2020 02:14:17 GMT</pubDate>
    <dc:creator>mmarchese</dc:creator>
    <dc:date>2020-04-09T02:14:17Z</dc:date>
    <item>
      <title>Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692124#M161970</link>
      <description>&lt;P&gt;I often have a special value in a text field, and I would like that value to be shown at the bottom of lists and last in graphs.&amp;nbsp; For example, say I have a Fruit field with these values, shown in the order I would like, which is alphabetical except for NONE being last:&lt;/P&gt;&lt;P&gt;Apples, Grapes, Oranges, NONE&lt;/P&gt;&lt;P&gt;In visualizations, I can control the sort order and get this result.&amp;nbsp; But there are places where the field choices appear that cannot be controlled in this manner.&amp;nbsp; For instance, what about when I click the search button at the top of the Fruit column in a table visualization?&amp;nbsp; There is no interface that lets me customize that list's sort.&amp;nbsp; Plus, I don't want to have to set the sort order in every single visualization.&amp;nbsp; I want to set it once.&lt;/P&gt;&lt;P&gt;I have found that if I use Dual('NONE', 1) instead of just 'NONE', I can get that value to appear last globally, which is exactly what I want.&amp;nbsp; But this is not good enough, because the text alignment is based on whether it's a string or a number/date.&amp;nbsp; If I use this technique, Apples, Grapes, and Oranges will be left-aligned, as they should be, and NONE will be right-aligned, which is ugly.&amp;nbsp; If I do Text(Dual('NONE', 1)), then I'm back to the wrong, purely-alphabetical sort:&amp;nbsp;Apples, Grapes, NONE, Orange.&amp;nbsp; I suppose I could probably work something out that makes every value into a number dual, but then everything would be right-aligned, which is not what I want for a text field.&lt;/P&gt;&lt;P&gt;I also tried using symbols instead of NONE, but Qlik treats symbols as earlier in the alphabet than letters, so that doesn't work either.&lt;/P&gt;&lt;P&gt;I would have thought this would have been a strength of the whole concept of duals, but it seems not to be the case.&amp;nbsp; If only I could do something like this, I'd be set: Dual('NONE', 'zzzzzz').&amp;nbsp; Or something like this: LeftAlign(Dual('NONE', 1))&lt;/P&gt;&lt;P&gt;Is there any way to keep everything left-aligned but control the sort order globally for a text field?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 18:10:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692124#M161970</guid>
      <dc:creator>mmarchese</dc:creator>
      <dc:date>2020-04-08T18:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692141#M161975</link>
      <description>&lt;P&gt;Not sure if you like this option, but what if you add an extra space before all Fruits except NONE... (Make sure to set Verbatim = 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SET Verbatim = 1;

Table:
LOAD * INLINE [
	Fruit
    " Apples"
    " Grapes"
    " Oranges"
    NONE
];&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Apr 2020 18:46:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692141#M161975</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-04-08T18:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692145#M161977</link>
      <description>&lt;P&gt;Hah, thanks, yeah that's actually another thing I tried.&amp;nbsp; While it does work, I don't like the spaces, especially since I know users will eventually download the data to Excel and discover the data's dirty secret &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Am I out of luck as far as finding a standard solution goes?&lt;/P&gt;&lt;P&gt;I can't be the first to come up against this.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 18:53:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692145#M161977</guid>
      <dc:creator>mmarchese</dc:creator>
      <dc:date>2020-04-08T18:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692147#M161979</link>
      <description>&lt;P&gt;I have had to address this in different objects, but not dashboard wide.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 18:56:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692147#M161979</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-04-08T18:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692148#M161980</link>
      <description>&lt;P&gt;How about None with a special character in front of it&lt;/P&gt;&lt;P&gt;Table:&lt;BR /&gt;LOAD If(Fruit = 'NONE', Chr(930)&amp;amp;Fruit, Fruit) as Fruit;&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Fruit&lt;BR /&gt;Apples&lt;BR /&gt;Grapes&lt;BR /&gt;Oranges&lt;BR /&gt;NONE&lt;BR /&gt;];&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 19:01:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692148#M161980</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-04-08T19:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692149#M161981</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Why don't you create a numeric field when loading data using if statement in same table like&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;table:
load
    yourfield,
    if(yourfield='NONE' or yourfield='zzzzz',9,1) as yourfieldsort
from table;&lt;/LI-CODE&gt;&lt;P&gt;and when using this dimension in chart go to sorting and use sort by expression and put&amp;nbsp;yourfieldsort there and select ascending.&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;Regards,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 19:09:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692149#M161981</guid>
      <dc:creator>usamabinsadiq</dc:creator>
      <dc:date>2020-04-08T19:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692222#M162000</link>
      <description>&lt;P&gt;Sunny_talwar:&lt;/P&gt;&lt;P&gt;Thanks, your idea to use chr() got me thinking.&amp;nbsp; I don't like char(930) in particular because it just shows up as a rectangle for me, but there are other choices that are ok.&lt;/P&gt;&lt;P&gt;I ran this to see what options I had:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Chars:
LOAD
    RowNo() AS code,
    Chr(RowNo()) AS char,
    If(Chr(RowNo()) &amp;gt; 'z', 'Yes', 'No') AS isAfterZ
AutoGenerate 150000;&lt;/LI-CODE&gt;&lt;P&gt;The two ideas I came up with from that experiment are:&lt;/P&gt;&lt;P&gt;1) The Greek letter Nu, which looks identical to the ASCII letter N:&amp;nbsp;Chr(925) &amp;amp; 'ONE'&lt;/P&gt;&lt;P&gt;You end up with something that looks like NONE but sorts the way I want it, with NONE at the end.&amp;nbsp; The downside to this is that when people export the data, if they do a text search, they will be confused as to why they get no hits when they type NONE in Excel's find dialog.&amp;nbsp; I will have to teach them to copy and paste it instead of typing it.&lt;/P&gt;&lt;P&gt;2) One particular Unicode hyphen that Qlik treats as coming after Z, unlike the regular ASCII hyphen:&amp;nbsp;Chr(11451)&lt;/P&gt;&lt;P&gt;This has the same downside as #1 in that it will trick people into thinking it's a regular hyphen, but maybe it's slightly less insulting/annoying than a fake N.&amp;nbsp; I suppose I will go with this for now.&amp;nbsp;&amp;nbsp;Ultimately, I still consider this a hack and wish there were a better way, but what can you do?&lt;/P&gt;&lt;P&gt;The relevant parts of my code now look similar to this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Let blank = Chr(11451);
Set ReplaceBlanks = If(Len(Trim($1)), $1, '$(blank)');

Fruit:
LOAD *
INLINE [
    Fruit
    Apples
    Grapes
    Oranges
    $(blank)
];

SomeOtherTable:
LOAD
    $(ReplaceBlanks([Some Field])) AS [Some Field],
    ...
FROM ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 02:14:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692222#M162000</guid>
      <dc:creator>mmarchese</dc:creator>
      <dc:date>2020-04-09T02:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692224#M162001</link>
      <description>&lt;P&gt;Usamabinsadiq:&lt;/P&gt;&lt;P&gt;Thanks, but sorting expressions are not what I was looking for.&amp;nbsp; As stated in the question, they don't cover every case (like the search interface at the top of each column in table visualizations) and they have to be specified once per visualization, which is tedious to set up and unnecessarily difficult to maintain.&lt;/P&gt;&lt;P&gt;My zzzzzz example was an attempt to show what Dual would look like if it could accept one string to display and one string to sort by, but it cannot.&amp;nbsp; It accepts one string to display and one number to sort by.&amp;nbsp; I consider that a weakness of Dual().&amp;nbsp; As it stands, Dual() converts the field to a number, which makes it right-aligned.&amp;nbsp; For some reason, Dual() was implemented in such a way that it conflates sort order and data type.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 02:25:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692224#M162001</guid>
      <dc:creator>mmarchese</dc:creator>
      <dc:date>2020-04-09T02:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to control a text field's sort order globally without botching text alignment?</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692329#M162024</link>
      <description>&lt;P&gt;Amazing!! I am glad you were able to work your way through this.&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Sunny&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 11:33:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Is-there-a-way-to-control-a-text-field-s-sort-order-globally/m-p/1692329#M162024</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-04-09T11:33:49Z</dc:date>
    </item>
  </channel>
</rss>

