cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
Choose Language Hide Translation Bar
BabyDoragon
Level II

How can I properly arrange the order of options in the Column Switcher?

How can I properly arrange the order of options in the Column Switcher without changing the actual order of fields in a DataTable?

In the provided JSL, simply sorting the list of columns does not affect the order of options in the Column Switcher.

I have noticed that sometimes the actual order of columns in the DataTable can affect the order of options in the Column Switcher, but other times it does not (I do not know the reason). However, when working with a DataTable that has many columns, changing the order of the columns is very time-consuming and seems meaningless. Is there a way to achieve the desired sorting of options in the Column Switcher without changing the actual column order?

 

Names Default To Here(1); 
dt = open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column( "Column 0", formula( :weight+1 ) );
dt << New Column( "Column 14", formula( :weight+2 ) );
dt << New Column( "Column 3", formula( :weight+3 ) );
dt << New Column( "Column 2", formula( :weight+4 ) );
dt << New Column( "Column 11", formula( :weight+5) );
dt << New Column( "Column 1", formula( :weight+6 ) );
dt << New Column( "Column ", formula( :weight+7 ) );

col = dt << get column names( string );
SwitchOption = {};
For Each( {value, index}, col,
	If( Word( 2, value, " " ) != "",
		SwitchOption = Insert( SwitchOption, col[index] )
	)
);
//The column list before the order arrangement.
Graph = Graph Builder(
	Size( 534, 464 ),
	Show Control Panel( 0 ),
	Variables( X( :name ), Y( :Column 0 ) ),
	Elements( Points( X, Y, Legend( 5 ) ) )
);
Graph << Column Switcher(
	Column( "column 0" ),
	SwitchOption, 
										
	Title( "Test" )
);
//The column list after the order arrangement.
orderedSwitchOption = {};
oder = {};
For Each( {value, index}, SwitchOption, oder = Insert( oder, Num( Word( 2, value, " " ) ) ) );
oder = Sort List( oder );
For Each( {value, index}, oder,
	orderedSwitchOption = Insert( orderedSwitchOption, "Column " || Char( value ) )
);
Graph2 = Graph Builder(
	Size( 534, 464 ),
	Show Control Panel( 0 ),
	Variables( X( :name ), Y( :Column 0 ) ),
	Elements( Points( X, Y, Legend( 5 ) ) )
);

Graph2 << Column Switcher(
	Column( "column 0" ),
	orderedSwitchOption, 
										
	Title( "Ordered Column" )
);
1 REPLY 1
jthi
Super User

Re: How can I properly arrange the order of options in the Column Switcher?

I think with column switcher you either have to rely on column order of the table or alphabetical ordering

jthi_0-1753943345414.png

 

I'm not sure what Original Order means in this case though as it might have different meaning when we are talking about columns in a JMP table

jthi_1-1753943414965.png

but I think in the case of column switcher it might be "Table Order" and not Original Order.

 

For JMP Table

Using JMP > Enter and Edit Your Data > Organize Data in Data Tables > Rearrange Columns in Data Tabl... 

Original Order

Returns the columns to the order they were in when data table was last saved.

-Jarmo

Recommended Articles