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
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);
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);
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"
Which JMP version are you using?
Works fine for me (using JMP18.0.1)
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);