For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > Data Tables > Work with Columns > Add a Column Switcher
Publication date: 06/21/2023

Add a Column Switcher

Use the Column Switcher message to add a Column Switcher panel to a report window. The Column Switcher lets you quickly analyze different variables without having to re-create your analysis.

// add a Column Switcher to the report
obj << Column Switcher(<default_col>(<col1>, <col2>, ...);
 
// remove the Column Switcher from a report
obj << Remove Column Switcher();

For example, add the Column Switcher to a Contingency report for the Car Poll.jmp data:

dt = Open( "$SAMPLE_DATA/Car Poll.jmp" );
obj = dt << Contingency(
	Y( :size ),
	X( :marital status )
);
ColumnSwitcherObject = obj << Column Switcher(
	:marital status,
	{:sex, :country, :marital status}
);
// number of pixels for the switcher width
ColumnSwitcherObject << Set Size( 200 );
 

// number of columns to display in the switcher

ColumnSwitcherObject << Set NLines( 6 );

You can also share a Column Switcher between two platform reports:

dt = Open( "$SAMPLE_DATA/Nicardipine.jmp" );
New Window( "Column Switcher Example",
	H List Box(
		sexCS = dt << Column Switcher( :Sex, {:Sex, :Causality, :Race} ),
		nDist = Distribution( Nominal Distribution( Column( :Sex ) ) ),
		bar = Graph Builder(
			Show Control Panel( 0 ),
			Variables( X( :Sex ), Y( :Age ) ),
			Elements( Box Plot( X, Y, Legend( 5 ) ) )
		)
	)
);
 
sexCS << Link Platform( nDist );
sexCS << Link Platform( bar );

Note: If you are publishing reports that share a Column Switcher to JMP Public or JMP Live, add them to a dashboard instead of using JSL. See Combine and Present Reports Using Dashboards in Using JMP.

For more information about the Column Switcher, see Column Switcher in Using JMP.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).