<?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: In a situation where both numbers and text are present, how can we achieve the correct sorting? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/In-a-situation-where-both-numbers-and-text-are-present-how-can/m-p/822101#M100148</link>
    <description>&lt;P&gt;JMP uses different ways of sorting in different places (there is at least one old post of mine asking about this but might be difficult to find). You can try going through data table&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

stepListWithString = {"2", "3", "10_New", "9", "1"};

dt = New Table("A",
	New Column("A", Character, Nominal, Values(stepListWithString))
);
dt &amp;lt;&amp;lt; Sort(By(:A), Replace Table, Order(Ascending));
stepListWithStringSort = dt[0, 1];
Close(dt, no save);

show(stepListWithStringSort);
// stepListWithStringSort = {"1", "2", "3", "9", "10_New"};
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 12 Dec 2024 05:21:38 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-12-12T05:21:38Z</dc:date>
    <item>
      <title>In a situation where both numbers and text are present, how can we achieve the correct sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-situation-where-both-numbers-and-text-are-present-how-can/m-p/822079#M100146</link>
      <description>&lt;P&gt;&lt;SPAN&gt;As shown in the following JSL, sorting works correctly in ascending order when only numbers are present; however, when mixed with text, converting to numbers before sorting causes issues. What methods can be used to solve this problem?&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;stepList = {"2", "3", "10", "9", "1"};
stepListSort = Sort List( stepList );
stepListNum = {};
For( i = 1, i &amp;lt;= N Items( stepList ), i++, 
	Insert Into( stepListNum, Num( stepList[i] ) )
);
stepListNumSort = Sort List( stepListNum );

stepListWithString = {"2", "3", "10_New", "9", "1"};
stepListWithStringSort = Sort List( stepListWithString );
Show( stepListWithSting );
stepListNum = {};
For( i = 1, i &amp;lt;= N Items( stepList ), i++, 
	Insert Into( stepListNum, Num( stepListWithString[i] ) )
);
stepListWithStringNumSort = Sort List( stepListNum );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2024 02:30:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-situation-where-both-numbers-and-text-are-present-how-can/m-p/822079#M100146</guid>
      <dc:creator>BabyDoragon</dc:creator>
      <dc:date>2024-12-12T02:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: In a situation where both numbers and text are present, how can we achieve the correct sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-situation-where-both-numbers-and-text-are-present-how-can/m-p/822101#M100148</link>
      <description>&lt;P&gt;JMP uses different ways of sorting in different places (there is at least one old post of mine asking about this but might be difficult to find). You can try going through data table&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

stepListWithString = {"2", "3", "10_New", "9", "1"};

dt = New Table("A",
	New Column("A", Character, Nominal, Values(stepListWithString))
);
dt &amp;lt;&amp;lt; Sort(By(:A), Replace Table, Order(Ascending));
stepListWithStringSort = dt[0, 1];
Close(dt, no save);

show(stepListWithStringSort);
// stepListWithStringSort = {"1", "2", "3", "9", "10_New"};
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2024 05:21:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-situation-where-both-numbers-and-text-are-present-how-can/m-p/822101#M100148</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-12T05:21:38Z</dc:date>
    </item>
  </channel>
</rss>

