<?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 Sort order in custom sort window in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Sort-order-in-custom-sort-window/m-p/319114#M56964</link>
    <description>&lt;P&gt;How does the JMP Sort window pass ascending and descending from the buttons to the Col List Box (ListBoxBox?) to the OK button?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to make a custom sort window with limited options for data tables in a report.&amp;nbsp; I figured out how to do most of it, either building up a sort window from scratch, or starting with the JMP sort window. An example with the latter follows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get &lt;CODE class=" language-jsl"&gt;order_list == ????????;&lt;/CODE&gt;&amp;nbsp;from the Sort Window?&lt;/P&gt;&lt;P&gt;Getting the columns to sort by is easy with Get Items. How do I get the directions that are associated with the ascending and descending icons appearing before the data type and column name in the Column List Box?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="custom_sort_window.png" style="width: 288px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/27253i5D34B82A96F49B87/image-size/large?v=v2&amp;amp;px=999" role="button" title="custom_sort_window.png" alt="custom_sort_window.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a sample code.&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 = Open( "$SAMPLE_DATA/Big Class.jmp" );
Sort(dt);

sort_window = Get Window( "Sort" );
sort_window[1][1][1][3][1] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][1][2] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][5] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][4] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][3] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][2] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][1] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][2][2] &amp;lt;&amp;lt; Delete Box();

selected_column_box = sort_window[1][1][1][2][2][1][1][2];

sort_window[1][1][1][2][3][1] &amp;lt;&amp;lt; append( Button Box( "     OK     ",
    Print("OK clicked");
    sel_list = selected_column_box &amp;lt;&amp;lt; Get Items;
    sel_string = sel_list[1];
    For( i = 2, i &amp;lt;= N Items(sel_list), i++,
     	sel_string = sel_string || ", " || sel_list[i]
    );
    //// For Testing
//    order_list = {"Ascending", "Ascending"};
    order_list == ????????;
    order_string = order_list[1];
    For( i = 2, i &amp;lt;= N Items(order_list), i++,
       	order_string = order_string || ", " || order_list[i]
    );

    sort_statement = "dt &amp;lt;&amp;lt; Sort( By(^sel_string^), Order(^order_string^),  Replace Table);";
    Eval Insert Into( sort_statement );
	Eval( Parse( sort_statement ) );
    , &amp;lt;&amp;lt;Set Icon("RunTableScriptHover");
) );
sort_window[1][1][1][2][3][1] &amp;lt;&amp;lt; append( Button box("  Cancel  ",
	sort_window &amp;lt;&amp;lt; Close Window;
	Print( "Close Sort Window" ), &amp;lt;&amp;lt;Set Icon("TabClosePress");
) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;Thanks for any suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Jun 2023 11:06:35 GMT</pubDate>
    <dc:creator>twalk</dc:creator>
    <dc:date>2023-06-11T11:06:35Z</dc:date>
    <item>
      <title>Sort order in custom sort window</title>
      <link>https://community.jmp.com/t5/Discussions/Sort-order-in-custom-sort-window/m-p/319114#M56964</link>
      <description>&lt;P&gt;How does the JMP Sort window pass ascending and descending from the buttons to the Col List Box (ListBoxBox?) to the OK button?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to make a custom sort window with limited options for data tables in a report.&amp;nbsp; I figured out how to do most of it, either building up a sort window from scratch, or starting with the JMP sort window. An example with the latter follows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get &lt;CODE class=" language-jsl"&gt;order_list == ????????;&lt;/CODE&gt;&amp;nbsp;from the Sort Window?&lt;/P&gt;&lt;P&gt;Getting the columns to sort by is easy with Get Items. How do I get the directions that are associated with the ascending and descending icons appearing before the data type and column name in the Column List Box?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="custom_sort_window.png" style="width: 288px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/27253i5D34B82A96F49B87/image-size/large?v=v2&amp;amp;px=999" role="button" title="custom_sort_window.png" alt="custom_sort_window.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a sample code.&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 = Open( "$SAMPLE_DATA/Big Class.jmp" );
Sort(dt);

sort_window = Get Window( "Sort" );
sort_window[1][1][1][3][1] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][1][2] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][5] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][4] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][3] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][2] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][3][1][1] &amp;lt;&amp;lt; Delete Box();
sort_window[1][1][1][2][2][2] &amp;lt;&amp;lt; Delete Box();

selected_column_box = sort_window[1][1][1][2][2][1][1][2];

sort_window[1][1][1][2][3][1] &amp;lt;&amp;lt; append( Button Box( "     OK     ",
    Print("OK clicked");
    sel_list = selected_column_box &amp;lt;&amp;lt; Get Items;
    sel_string = sel_list[1];
    For( i = 2, i &amp;lt;= N Items(sel_list), i++,
     	sel_string = sel_string || ", " || sel_list[i]
    );
    //// For Testing
//    order_list = {"Ascending", "Ascending"};
    order_list == ????????;
    order_string = order_list[1];
    For( i = 2, i &amp;lt;= N Items(order_list), i++,
       	order_string = order_string || ", " || order_list[i]
    );

    sort_statement = "dt &amp;lt;&amp;lt; Sort( By(^sel_string^), Order(^order_string^),  Replace Table);";
    Eval Insert Into( sort_statement );
	Eval( Parse( sort_statement ) );
    , &amp;lt;&amp;lt;Set Icon("RunTableScriptHover");
) );
sort_window[1][1][1][2][3][1] &amp;lt;&amp;lt; append( Button box("  Cancel  ",
	sort_window &amp;lt;&amp;lt; Close Window;
	Print( "Close Sort Window" ), &amp;lt;&amp;lt;Set Icon("TabClosePress");
) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;Thanks for any suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:06:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sort-order-in-custom-sort-window/m-p/319114#M56964</guid>
      <dc:creator>twalk</dc:creator>
      <dc:date>2023-06-11T11:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sort order in custom sort window</title>
      <link>https://community.jmp.com/t5/Discussions/Sort-order-in-custom-sort-window/m-p/321871#M57177</link>
      <description>&lt;P&gt;Thanks to Wendy Murphrey in JMP technical support for giving me suggestions to help me do what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though I am still interested in knowing how ascending and descending are accessed by elements of the sort window, I don't need it. Anybody who has an answer to that question, please feel free to let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be that as it may, my objective is to sort tables in report tabs. These tables are linked to invisible tables where the sorting is actually done. However, I have to force replacing tables, so that users are not creating tons of untracked tables when working in the reports.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leaving aside all of the report creation and managing report tables in tabs, here is an update on the heart of sorting background invisible tables that should work for our report tables.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Sort(dt);

sort_window = Get Window( "Sort" );

// For stability, collapse, don't delete window elements
sort_window[1][1][1][3][1] &amp;lt;&amp;lt; Visibility( "Collapse" );
sort_window[1][1][1][2][3][1][4] &amp;lt;&amp;lt; Visibility( "Collapse" );
sort_window[1][1][1][2][2][2] &amp;lt;&amp;lt; Visibility( "Collapse" );
sort_window[1][1][1][2][1][2] &amp;lt;&amp;lt; Visibility( "Collapse" );

sort_window &amp;lt;&amp;lt; OnClose(
    dt1 = Get Data Table( 1 );
   // Include name check in case users figure out a way
   // to replace tables themselves, despite collapsing that option above
    old_name = dt &amp;lt;&amp;lt; Get Name();
    new_name = dt1 &amp;lt;&amp;lt; Get Name();
    if( new_name != old_name, 
        dt &amp;lt;&amp;lt; Update( With( dt1 ) );
        Close(dt1, "No Save")  
    );    
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Oct 2020 01:03:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sort-order-in-custom-sort-window/m-p/321871#M57177</guid>
      <dc:creator>twalk</dc:creator>
      <dc:date>2020-10-15T01:03:21Z</dc:date>
    </item>
  </channel>
</rss>

