<?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: Scripting Table Sort by User Defined Column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/7844#M7838</link>
    <description>&lt;P&gt;You need to use the &lt;STRONG&gt;column&lt;/STRONG&gt; function or the &lt;STRONG&gt;eval&lt;/STRONG&gt; function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = open("$sample_data\Big Class.jmp");
 
_userCol = "age";
 
dt &amp;lt;&amp;lt; Sort( By(column(dt, _userCol)), Order(Ascending), Replace Table);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Sort( By(eval(_userCol)), Order(Ascending), Replace Table);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Jun 2018 16:47:49 GMT</pubDate>
    <dc:creator>pmroz</dc:creator>
    <dc:date>2018-06-04T16:47:49Z</dc:date>
    <item>
      <title>Scripting Table Sort by User Defined Column</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/7843#M7837</link>
      <description>&lt;P&gt;Warning - scripting newbie @ work. I'm working on a script, a part of which sorts the data table by the user selected column (obtained by ColList selection and Eval List).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This does not work, it brings up the Sort dialog, which I don't want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Sort( By(_userCol), Order(Ascending), Replace Table);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I hover over _userCol, the assigned column is shown in the scripting window.&amp;nbsp; If I use the exact column name, it works without bringing up the Sort dialog:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Sort( By(:Timestamp), Order(Ascending), Replace Table);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I script this using the variable _userCol?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 16:47:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/7843#M7837</guid>
      <dc:creator>markschahl</dc:creator>
      <dc:date>2018-06-04T16:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Table Sort by User Defined Column</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/7844#M7838</link>
      <description>&lt;P&gt;You need to use the &lt;STRONG&gt;column&lt;/STRONG&gt; function or the &lt;STRONG&gt;eval&lt;/STRONG&gt; function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = open("$sample_data\Big Class.jmp");
 
_userCol = "age";
 
dt &amp;lt;&amp;lt; Sort( By(column(dt, _userCol)), Order(Ascending), Replace Table);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Sort( By(eval(_userCol)), Order(Ascending), Replace Table);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 16:47:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/7844#M7838</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-06-04T16:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Table Sort by User Defined Column</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/7845#M7839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. Solved my problem. Subsequently learned about using As Column(_usercol) when using the column in a formula.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 19:53:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/7845#M7839</guid>
      <dc:creator>markschahl</dc:creator>
      <dc:date>2013-12-18T19:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Table Sort by User Defined Column</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/195022#M41593</link>
      <description>&lt;P&gt;Hello Sir,&lt;/P&gt;&lt;P&gt;Is it possible if i can order the the table by a predefined list instead of ascending or descending order. e.g&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = open("$sample_data\Big Class.jmp");
 _userCol = "name";
 dt &amp;lt;&amp;lt; Sort( By(column(dt, _userCol)), Order(Descending), Replace Table);&lt;BR /&gt;&lt;BR /&gt;instead of the above, i like to order the table by name in a order given by "list" below?
list={"BARBARA","ALFRED","CHRIS","ALICE","AMY","CAROL","CLAY","DANNY","DAVID","EDWARD","ELIZABETH","FREDERICK","HENRY","JACLYN","JAMES","JANE","JEFFREY","JOE","JOHN","JUDY","KATIE","KIRK","LAWRENCE","LESLIE","LEWIS","LILLIE","LINDA","LOUISE","MARION","MARK","MARTHA","MARY","MICHAEL","PATTY","PHILLIP","ROBERT","SUSAN","TIM","WILLIAM"};&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Apr 2019 20:04:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/195022#M41593</guid>
      <dc:creator>ram_asra_gmail_</dc:creator>
      <dc:date>2019-04-25T20:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Table Sort by User Defined Column</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/195023#M41594</link>
      <description>&lt;P&gt;Well....kind of.&lt;/P&gt;
&lt;P&gt;If you set the "Value Ordering" column property for the column you want oredered, and then sort by that column, the resulting sort will be ordered based upong the specified order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

dt:name &amp;lt;&amp;lt; set property(
	"value ordering",
	{"ALICE", "BARBARA", "CHRIS", "ALFRED", "CLAY", "DAVID", "EDWARD", "CAROL", "AMY", "ELIZABETH", "DANNY",
	"HENRY", "JACLYN", "JAMES", "JANE", "JEFFREY", "JOE", "JOHN", "KIRK", "LAWRENCE", "JUDY", "FREDERICK",
	"LEWIS", "KATIE", "LESLIE", "LINDA", "MARION", "MARK", "LILLIE", "LOUISE", "MARY", "MICHAEL", "PATTY",
	"WILLIAM", "SUSAN", "PHILLIP", "MARTHA", "ROBERT", "TIM"}
);

dt &amp;lt;&amp;lt; sort( by( :name ), order( ascending ), replace table( 1 ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Apr 2019 20:27:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/195023#M41594</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-04-25T20:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Table Sort by User Defined Column</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/195024#M41595</link>
      <description>&lt;P&gt;Just got it on another thread.&lt;/P&gt;&lt;P&gt;1. first add list check&lt;/P&gt;&lt;P&gt;Column( Data Table( "Summary" ),"ITEM") &amp;lt;&amp;lt; Set Property(List Check, summary_items);&lt;/P&gt;&lt;P&gt;2. Perform table sort.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Custom-Sort-Order/td-p/3119" target="_self"&gt;https://community.jmp.com/t5/Discussions/Custom-Sort-Order/td-p/3119&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 20:18:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Table-Sort-by-User-Defined-Column/m-p/195024#M41595</guid>
      <dc:creator>ram_asra_gmail_</dc:creator>
      <dc:date>2019-04-25T20:18:29Z</dc:date>
    </item>
  </channel>
</rss>

