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
minion
Level II

column switcher linked multiple platform

dt = Open( "$SAMPLE_DATA/Process Measurements.jmp" );

clear log();

colnames = dt << getcolumnnames(numeric,string);
colnames = Filter Each({name}, colnames, !Is Missing(Regex(lowercase(name), "^(process).*")));

print(colnames[1]);

New Window("reacher",
	H List Box(
		V List Box (
			dist = dt << Distribution(Continuous Distribution(Column(column(dt, colnames[1])),Process Capability( 0 )),Histograms Only),
			biv = Bivariate( Y(column(dt, colnames[1])), X(column(dt, colnames[1])) )
		),
		cs = dt << Column Switcher(:Process 1, colnames),
//		cs = dt << Column Switcher(colnames[1], colnames),
	)
);
cs << Link Platform( dist );
cs << Link Platform( biv );

Trying to script column switcher for arbitrary table.

 

Code above works.

 

However, when line16 is commented and line17 uncommented, column switcher does not work

 

Please help 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: column switcher linked multiple platform

You might have to evaluate the colnames[1] in correct format to column switcher. Here is one option

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Process Measurements.jmp");

colnames = dt << getcolumnnames(numeric, string);
colnames = Filter Each({name}, colnames, !Is Missing(Regex(Lowercase(name), "^(process).*")));

Eval(EvalExpr(
	nw = New Window("reacher",
		H List Box(
			V List Box(
				dist = dt << Distribution(
					Continuous Distribution(Column(Eval(colnames[1])), Process Capability(0)),
					Histograms Only
				),
				biv = Bivariate(Y(Eval(colnames[1])), X(Eval(colnames[1])))
			),
			cs = dt << Column Switcher(Expr(NameExpr(AsColumn(dt, colnames[1]))), colnames)
		)
	);	
));

cs << Link Platform(dist);
cs << Link Platform(biv);
-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: column switcher linked multiple platform

You might have to evaluate the colnames[1] in correct format to column switcher. Here is one option

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Process Measurements.jmp");

colnames = dt << getcolumnnames(numeric, string);
colnames = Filter Each({name}, colnames, !Is Missing(Regex(Lowercase(name), "^(process).*")));

Eval(EvalExpr(
	nw = New Window("reacher",
		H List Box(
			V List Box(
				dist = dt << Distribution(
					Continuous Distribution(Column(Eval(colnames[1])), Process Capability(0)),
					Histograms Only
				),
				biv = Bivariate(Y(Eval(colnames[1])), X(Eval(colnames[1])))
			),
			cs = dt << Column Switcher(Expr(NameExpr(AsColumn(dt, colnames[1]))), colnames)
		)
	);	
));

cs << Link Platform(dist);
cs << Link Platform(biv);
-Jarmo
minion
Level II

Re: column switcher linked multiple platform

Thanks for the note.

If the column name has special characters in the name, the expression does not work

Example columns: "Process:USL=8:LSL=1.0"

jthi
Super User

Re: column switcher linked multiple platform

Which JMP version are you using?

Works fine for me (using JMP18.0.1)

jthi_0-1723057760049.png

jthi_1-1723057767404.png

View more...
Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Process Measurements.jmp");

Column(dt, 1) << Set Name("Process:USL=8:LSL=1.0");


colnames = dt << getcolumnnames(numeric, string);
colnames = Filter Each({name}, colnames, !Is Missing(Regex(Lowercase(name), "^(process).*")));

Eval(
	Eval Expr(
		nw = New Window("reacher",
			H List Box(
				V List Box(
					dist = dt << Distribution(
						Continuous Distribution(
							Column(Eval(colnames[1])),
							Process Capability(0)
						),
						Histograms Only
					),
					biv = Bivariate(Y(Eval(colnames[1])), X(Eval(colnames[1])))
				),
				cs = dt << Column Switcher(
					Expr(
						Name Expr(As Column(dt, colnames[1]))
					),
					colnames
				)
			)
		)
	)
);

cs << Link Platform(dist);
cs << Link Platform(biv);
-Jarmo