cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
avner8943
Level I

create subset with list of columns

Hi,

 

I want to create a list of columns to use in "column switcher", something like that.

 

col_list = temp_dt << Get Columns Name();

current data table (dt_main);

obj = Graph Builder(...)

Col_Switcher = obj << Column Switcher( :col1, col_list );

But it is not working...

 

Any ideas?

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: create subset with list of columns

Here is an example that works.

I assume that it will work for you, which means, if your code isn't working you need to look at your data to see what is wrong.  You may want to look at the list of columns that you are getting from your dt_temp data table.  Are the columns selected existing in the dt_main data table?

names default to here(1);
dt=open("$SAMPLE_DATA/Semiconductor Capability.jmp");

dtSub = dt << subset(columns({PNP1,PNP2,PNP3}));
col_List = dtsub<<get column names(continuous);

gb = dt << Graph Builder(
	Variables( X( :PNP4 ), Y( :NPN1 ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
Col_Switcher = gb << Column Switcher(
		:PNP4,
		col_List
	);

 

Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: create subset with list of columns

Here is an example that works.

I assume that it will work for you, which means, if your code isn't working you need to look at your data to see what is wrong.  You may want to look at the list of columns that you are getting from your dt_temp data table.  Are the columns selected existing in the dt_main data table?

names default to here(1);
dt=open("$SAMPLE_DATA/Semiconductor Capability.jmp");

dtSub = dt << subset(columns({PNP1,PNP2,PNP3}));
col_List = dtsub<<get column names(continuous);

gb = dt << Graph Builder(
	Variables( X( :PNP4 ), Y( :NPN1 ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
Col_Switcher = gb << Column Switcher(
		:PNP4,
		col_List
	);

 

Jim