cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • Use JMP Clinical with CDISC-compliant data. Review studies, ID safety and efficacy signals & communicate findings with interactive graphics. Register to see how. Aug. 27, 2 pm US ET.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
nozellot
Level II

For Loop in "Expr" not working

Hello,
this is a representation of the script I am having a problem with:

 

n = 100;

ow = Expr(
	OneWay(Y(colPara), X(splitPara),
		MeansAndStdDev(0), AllGraphs(0), LineOfFit(0), StdDevLines(1), Legend(1), PlotQuantileByActual(1),
		SendToReport(
			Dispatch({}, "Normal Quantile Plot", OutlineBox, {SetTitle("")}),
For(l = 0, l <= n, l++, Dispatch({"Normal Quantile Plot"}, "2", ScaleBox, {Format("Best", 6), AddRefLine(l/100, "Dotted", "Black", Char(l) || "/100", 1), ) ) ) ); rep = Eval(EvalExpr(ow)) << Report;

So I am trying to create save a OneWay-Plot in an expression that will be evaluated later and turned into a report.
The first dispatch does what it is intended to do:

Dispatch({}, "Normal Quantile Plot", OutlineBox, {SetTitle("")})

However, the For Loop doesn't work and I believe it has something to do with how JMP handles running variables in combination with the Expr/Eval works.

For(l = 0, l <= n, l++, 
Dispatch({"Normal Quantile Plot"}, "2", ScaleBox, {Format("Best", 6), AddRefLine(l/100, "Dotted", "Black", Char(l) || "/100", 1),
)


Is there some sort of solution or workaround for this?
Best regards <3

 

1 REPLY 1
jthi
Super User

Re: For Loop in "Expr" not working

I would create function for this and within that function, I would move the For loop outside of the platform run.

I think something like this could work (there are plenty of other options)

Names Default To Here(1);

create_oneway = Function({dt, colpara, splitpara, n = 100}, {Default Local},
	ow = dt << OneWay(
		Y(Eval(colPara)), 
		X(Eval(splitPara)),
		MeansAndStdDev(0), 
		AllGraphs(0), 
		LineOfFit(0), 
		StdDevLines(1), 
		Legend(1), 
		PlotQuantileByActual(1)
	);
	
	rep = ow << report;
	For(l = 0, l <= n, l++,
		rep << Dispatch(
			{"Normal Quantile Plot"}, "2", ScaleBox, 
			{
				Format("Best", 6),
				Add Ref Line(l/100, "Dotted", "Black", Char(l) || "/100", 1)
			}
		);
	);
	
	rep << Dispatch({}, "Normal Quantile Plot", OutlineBox, {SetTitle("")});
	
	return(ow);
);


dt = open("$SAMPLE_DATA/Big Class.jmp");


ow = create_oneway(dt, "weight", "age");

Write();

 

You could use Expr but in that case I would build the expression from few different parts

-Jarmo

Recommended Articles