cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Zahzul
Level I

How do I input a variable into "Historical Data End at Row" option for Multivariate Control Chart in JSL?

Hello.

This is taken from one of the Scripting Index script.

I was trying to write a JSL that essentially will have row_end as a dynamic input, but my current code below wouldn't work as intended.

How do I write it so that it can work? I've tried putting the whole expression into Eval (Eval Parse(Expression)) but that also did not work.

If I replace row_end with it's actual value, only then will my code work. Any ideas? Thanks.

I'm using JMP16.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Quality Control/Flight Delays.jmp" );
row_end = 16;
obj = dt << Model Driven Multivariate Control Chart( Process( :AA, :CO, :DL, :F9, :FL, :NW, :UA, :US, :WN ), Historical Data End at Row( row_end ) );
1 REPLY 1
txnelson
Super User

Re: How do I input a variable into "Historical Data End at Row" option for Multivariate Control Chart in JSL?

The "Historical Data End at Row()" appears to not be able to evaluate a variable. Therefore, one needs to handle that in JSL.  A common way to do that is to use "Eval Insert()".

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Quality Control/Flight Delays.jmp" );
row_end = 16;
Eval(
	Parse(
		Eval Insert(
			"obj = dt << Model Driven Multivariate Control Chart( Process( :AA, :CO, :DL, :F9, :FL, :NW, :UA, :US, :WN ), Historical Data End at Row( ^row_end^ ))"
		)
	)
);

Or, one could use a Substitute() function to handle the issue

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Quality Control/Flight Delays.jmp" );
row_end = 16;
Eval(
	Substitute(
			Expr(
				obj = dt << Model Driven Multivariate Control Chart(
					Process( :AA, :CO, :DL, :F9, :FL, :NW, :UA, :US, :WN ),
					Historical Data End at Row( theEnd )
				)
			),
		Expr( theEnd ), row_end
	)
);
Jim