There were 2 issues.
- The value for the variable "Version" had not been set.
- 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