How does the JMP Sort window pass ascending and descending from the buttons to the Col List Box (ListBoxBox?) to the OK button?
I need to make a custom sort window with limited options for data tables in a report. 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.
How do I get order_list == ????????;
from the Sort Window?
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?
Here is a sample code.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Sort(dt);
sort_window = Get Window( "Sort" );
sort_window[1][1][1][3][1] << Delete Box();
sort_window[1][1][1][2][1][2] << Delete Box();
sort_window[1][1][1][2][3][1][5] << Delete Box();
sort_window[1][1][1][2][3][1][4] << Delete Box();
sort_window[1][1][1][2][3][1][3] << Delete Box();
sort_window[1][1][1][2][3][1][2] << Delete Box();
sort_window[1][1][1][2][3][1][1] << Delete Box();
sort_window[1][1][1][2][2][2] << Delete Box();
selected_column_box = sort_window[1][1][1][2][2][1][1][2];
sort_window[1][1][1][2][3][1] << append( Button Box( " OK ",
Print("OK clicked");
sel_list = selected_column_box << Get Items;
sel_string = sel_list[1];
For( i = 2, i <= 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 <= N Items(order_list), i++,
order_string = order_string || ", " || order_list[i]
);
sort_statement = "dt << Sort( By(^sel_string^), Order(^order_string^), Replace Table);";
Eval Insert Into( sort_statement );
Eval( Parse( sort_statement ) );
, <<Set Icon("RunTableScriptHover");
) );
sort_window[1][1][1][2][3][1] << append( Button box(" Cancel ",
sort_window << Close Window;
Print( "Close Sort Window" ), <<Set Icon("TabClosePress");
) );
Thanks for any suggestions.