Subscribe Bookmark RSS Feed

JSL automate the columns used in Process Capability

jay_S

Occasional Contributor

Joined:

Jun 1, 2017

Hello,

so i want to write a JSL script that can run Process Capability on the click of a button on a tool bar. i have every thing coded except for Process Variables. see code below. how will i be able to dynamically add the columns in "process variables()"

func_Process_Cap = Function({summ_table,spec_table},
	// local vars
	{},

	Process Capability(
		Process Variables( // hard coded - not ideal
			:Name( "column1" ), //some columns are preseeded by :name()
			:column2		   // some are not
		),
		Spec Limits(
			Import Spec Limits(spec_table) // dynamic
		),
		Individual Detail Reports( 1 ),
		Capability Box Plots( 0 ),
		Overall Sigma Summary Report( 1 ),
		Goal Plot( 0 ),
		Capability Index Plot( 0 ),
		Order By( "Overall Sigma Ppk Ascending" ),
	);
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Try this

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

// Create a complex name for a column to make sure it will be
// processed correctly
dt:NPN1 << set name( "NPN1-7/Best" );

// Get a list of columns to be used
colList = dt << get column names( continuous, string );

ProcessFunc = Function( {TheList}, 
	// Move them into a single literal string of the format required
	// for the Process Variables element in the Process Capability
	// platform
	TheVars = ":Name(\!"" || TheList[1] || "\!")";
	For( i = 2, i <= 10, i++,
		TheVars = TheVars || "," || ":Name(\!"" || TheList[i] || "\!")"
	);

	// Run the Process Capability platform, using the literal
	// string "TheVars" 
	Eval(Parse("dt << Process Capability( 
		Process Variables( "|| TheVars|| ") ) ,
		 Goal Plot( 1 ), Capability Index Plot( 1 ) 
	 );"));
);

Return = ProcessFunc( colList );
Jim
4 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

I am not quite sure if the script (see below) I wrote will give you a possible direction in where you want to go.  

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

// Create a complex name for a column to make sure it will be
// processed correctly
dt:NPN1 << set name( "NPN1-7/Best" );

// Get a list of columns to be used
colList = dt << get column names( continuous, string );

ProcessFunc = Function( {TheList}, 
	// Move them into a single literal string of the format required
	// for the Process Variables element in the Process Capability
	// platform
	TheVars = ":Name(\!"" || TheList[1] || "\!")";
	For( i = 2, i <= N Items( TheList ), i++,
		TheVars = TheVars || "," || ":Name(\!"" || TheList[i] || "\!")"
	);

	// Run the Process Capability platform, using the literal
	// string "TheVars" 
	dt << Process Capability( 
		Process Variables( Eval( Parse( TheVars ) ) ),
		 Goal Plot( 1 ), Capability Index Plot( 1 ) 
	 );
);

Return = ProcessFunc( colList );
Jim
jay_S

Occasional Contributor

Joined:

Jun 1, 2017

its a good start but it only accepts the 1st column. i made a dummy data table ,(column1,column2,column3), and modiefied the how the string looked to match the script i saved of the anlysis on the dummy data and it still only accepts the first column. will try different methods and if i find anything will report back!

txnelson

Super User

Joined:

Jun 22, 2012

Solution

Try this

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

// Create a complex name for a column to make sure it will be
// processed correctly
dt:NPN1 << set name( "NPN1-7/Best" );

// Get a list of columns to be used
colList = dt << get column names( continuous, string );

ProcessFunc = Function( {TheList}, 
	// Move them into a single literal string of the format required
	// for the Process Variables element in the Process Capability
	// platform
	TheVars = ":Name(\!"" || TheList[1] || "\!")";
	For( i = 2, i <= 10, i++,
		TheVars = TheVars || "," || ":Name(\!"" || TheList[i] || "\!")"
	);

	// Run the Process Capability platform, using the literal
	// string "TheVars" 
	Eval(Parse("dt << Process Capability( 
		Process Variables( "|| TheVars|| ") ) ,
		 Goal Plot( 1 ), Capability Index Plot( 1 ) 
	 );"));
);

Return = ProcessFunc( colList );
Jim
jay_S

Occasional Contributor

Joined:

Jun 1, 2017

works great! i added pcVar = Eval(.... to the script and i am able to send commands to the window so pcVar << Goal Plot(0); for further customization. for the people who see this in the future!

pcVar =Eval(Parse("dt << Process Capability(
Process Variables( "|| TheVars|| ") ) ,

);"));
pcVar <<Order By( "Overall Sigma Ppk Ascending" );