cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

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

Zahzul
Level I

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