cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
ppopp1618
Level I

Adding in spec limits script, error when moving to jmp 16

Hi Folks, new to jmp scripting.  I have a script attached that was written in 2012 and now does not function since moving to jmp16, it worked under jmp14.  It basically allows me to read in the upper and lower spec limits for all the column parameters. Below is the error message and a sample of my data file once I have read it in.  Any help would be greatly appreciated.  I did not write the script and the person has since left the company.

Thanks in advance for any assistance.

 

ppopp1618_0-1648660123282.png

 

ppopp1618_1-1648660196010.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Adding in spec limits script, error when moving to jmp 16

There is nothing to watch with Names Default to Here().  It is just setting a default scoping.  If your code is in the middle of a larger piece of code, the Names Default to Here() should be moved to the first line of the JSL, and if that does not work, then remove the line completely.  I also added a new If() clause, to not process the Spec Limits if the column is not a numeric continuous column.

Remove the 

Version = JMPVersion();

and use your

Version = "Limits as Attributes, v2.1 December 24, 2012";
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Adding in spec limits script, error when moving to jmp 16

There were 2 issues.

  1. The value for the variable "Version" had not been set.
  2. In JMP 16, the code stops when it comes across a Character variable.

I fixed both issues.  Rather than checking for a Data Type of Character, I actually check to make sure the Modeling Type is Continuous.  Nominal or Ordinal numeric columns also should not have Spec Limits set.

Names Default To Here( 1 );
version = JMP Version();
/*** This script will save the values in the specified rows as ***/
/*** Spec Limit column attributes for each respective column.  ***/
/*** If there is no value for a particular column, the Spec    ***/
/*** Limit attribute for that column will not be changed. By   ***/
/*** saving the limits as column attributes, the Cpk analysis  ***/
/*** along with limits reference markers, will automatically   ***/
/*** be generated whenever a distribution is generated for a   ***/
/*** column.                                                   ***/
/*** Alternatively, this script can be used to delete the      ***/
/*** Spec Limits column attributes altogether by checking the  ***/
/*** "Delete Attributes" checkbox.                             ***/

// 10/28/2004 v2.0
// 12/24/2012 v2.1, modified to handle limits with units, like "2 Ohms"

Limits_dlg = Dialog(
	Text Box( Version ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( "Spec Limits:" ),
	Text Box( " " ),
	LineUp( 2,
		"LSL is in row", LSLRow = EditNumber( 1 ),
		"USL is in row", USLRow = EditNumber( 2 )
	),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( "My table already has Spec Limits attributes, and I want to delete them... " ),
	DelAttr = Check Box( "Delete Attributes", 0 ),
	Text Box( " " ),
	HList( Button( "OK" ), Button( "Cancel" ) )
);

If( Limits_dlg["Button"] == -1,
	Throw( "!User Cancelled" )
);

If( Limits_dlg["DelAttr"] == 1,
	For( i = 1, i < N Col() + 1, i++,
		Column( i ) << Delete Property( "Spec Limits" )
	),  
   //Else...
	For( i = 1, i < N Col() + 1, i++,
		If( As Column( i ) << get modeling type == "Continuous",
			LSpec = Column( i )[Limits_dlg["LSLRow"]];
			LSpec = Num( Word( 1, Char( LSpec ) ) ); //Truncate to numeric if it has units appended to it.
			USpec = Column( i )[Limits_dlg["USLRow"]];
			USpec = Num( Word( 1, Char( USpec ) ) ); //Truncate to numeric if it has units appended to it.
			Eval(
				Substitute(
						Expr(
							Column( i ) << Set Property(
								"Spec Limits",
								{LSL( _LSL ), USL( _USL ), show limits( 1 )}
							)
						),
					Expr( _LSL ), LSpec,
					Expr( _USL ), USpec
				)
			);
		)
	)
);

Jim
ppopp1618
Level I

Re: Adding in spec limits script, error when moving to jmp 16

Thanks TX,

 Still same error message.  You only added two lines I believe, no other changes?

 

I noticed I missed an original line in the org file.

Version = "Limits as Attributes, v2.1 December 24, 2012";

above was in the original file, not sure if that changes your proposed solution.

 

When I watch the values for Version it certainly reads 16 witch is what I am running.   It hangs up when I try to watch Names Default to Here?

Names Default To Here (1);
Version = JMP version ();

 

Thanks

 

txnelson
Super User

Re: Adding in spec limits script, error when moving to jmp 16

There is nothing to watch with Names Default to Here().  It is just setting a default scoping.  If your code is in the middle of a larger piece of code, the Names Default to Here() should be moved to the first line of the JSL, and if that does not work, then remove the line completely.  I also added a new If() clause, to not process the Spec Limits if the column is not a numeric continuous column.

Remove the 

Version = JMPVersion();

and use your

Version = "Limits as Attributes, v2.1 December 24, 2012";
Jim
ppopp1618
Level I

Re: Adding in spec limits script, error when moving to jmp 16

Thank you kindly sir, that did the trick!!