Subscribe Bookmark RSS Feed

Importing Spec Limits

jay_S

Occasional Contributor

Joined:

Jun 1, 2017

So I have a script that runs Process Capability on a table of data. I am able to run it automatically using this solution, https://community.jmp.com/t5/Discussions/JSL-automate-the-columns-used-in-Process-Capability/m-p/398.... I am now trying to import the spec sheet automatically too. Right now users automatically have 2 sheets. 1 with data and 1 with the spec info. I can make a solution that takes the spec sheet info and copys it to the column properties, but i would rather have it run in the code in case users want to use the data sheet with another spec file.

 

my code so far...

    yyy = Eval(    Parse("summ_table << Process Capability(
                                                            Process Variables( " || TheVars || "),  <<works
                                                            Spec Limits(Import Spec Limits(\!"" || Spec ||"\!")) <<not working
                                                            
                                                        );"
                    )
                );

spec holds the open spec tables name. i can easly get it in these 2 formats.

"specTable1.jmp"

"DataTable("specTable1.jmp")"

 

i got the spec limits code from this blog -- https://community.jmp.com/t5/JMPer-Cable/3-ways-to-load-your-specification-limits-into-Process-Capab...

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

JSL is capable of performing almost anything you need to have done, so in response to your question, yes, you can select the data table an then the limits table, and then run process capability.  Here is a very simple script that does exactly that.  I have tested it with the attached data and limits table.  The code is definatly not bulletproof.  But it should show you how to proceed.

Names Default To Here( 1 );

// Select the data table and open it
path = Pick File( "Select Data Table" );
dt = Open( path );

// Select the limits table and open it
path = Pick File( "Select Limits Table" );
dt2 = Open( path );

// Point to the data table as the main table
Current Data Table( dt );

// Open a new window to select the process variables
nw = New Window( "Select Process Variables",
	Text Box( "Selection Columns" ),
	H List Box(
		datacolbox = Col List Box( all ),
		Button Box( "Process Variables", pList << append( datacolbox << get selected ) ),
		pList = List Box( {} )
	),
	Button Box( "OK",
		thelist = plist << get items;
		pvars = ":" || thelist[1];
		For( i = 2, i <= N Items( thelist ), i++,
			pvars = pvars || ",:" || thelist[i]
		);
		Eval(
			Parse(
				"obj = dt << Process Capability(
	Process Variables(" || pvars || " ),
	Spec Limits( Import Spec Limits( dt2 ) )
);"
			)
		);
	nw << close window;
	)
);
Jim
6 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

There is a JMP Addin that will populate Spec Limits from an additional data table that has the spec limits in it.

Write Limits to a Data Table from a Limits Table

 

If it doesn't do exactly what you want, you can always pull out the JSL and modify it to meet your needs

Jim
jay_S

Occasional Contributor

Joined:

Jun 1, 2017

I looked at that add on's code and to me it seems to do something ive already done. basically it edits the columns in a table to have the limits characteristics.

 

I’m wondering if it’s possible to use JSL to basically ask the user for a sheet with data and a sheet with the limits/specs. After the user inputs those 2 than the script will run automatically afterwards and run capability analysis on the sheet with the data. so basically is it possible to run a spec sheet  in a capability analysis using JSL. I’m wondering if this line is possible like described in the 2nd post linked in the original post.

 

Spec Limits(Import Spec Limits(\!" specLimits.jmp\!"))

It seems to not be working. Should I just try and format it like this? and have a long string containing all the limit/spec information?

 

Spec Limits(
		c1( LSL( -1.4 ), Target( . ), USL( . ) ),
		c2 2( LSL( -1.4 ), Target( . ), USL( . ) ),
		Name( "c3" )(LSL( 12 ), Target( . ), USL( 144 )),
		c4( LSL( . ), Target( . ), USL( -18 ) )
	),
txnelson

Super User

Joined:

Jun 22, 2012

Solution

JSL is capable of performing almost anything you need to have done, so in response to your question, yes, you can select the data table an then the limits table, and then run process capability.  Here is a very simple script that does exactly that.  I have tested it with the attached data and limits table.  The code is definatly not bulletproof.  But it should show you how to proceed.

Names Default To Here( 1 );

// Select the data table and open it
path = Pick File( "Select Data Table" );
dt = Open( path );

// Select the limits table and open it
path = Pick File( "Select Limits Table" );
dt2 = Open( path );

// Point to the data table as the main table
Current Data Table( dt );

// Open a new window to select the process variables
nw = New Window( "Select Process Variables",
	Text Box( "Selection Columns" ),
	H List Box(
		datacolbox = Col List Box( all ),
		Button Box( "Process Variables", pList << append( datacolbox << get selected ) ),
		pList = List Box( {} )
	),
	Button Box( "OK",
		thelist = plist << get items;
		pvars = ":" || thelist[1];
		For( i = 2, i <= N Items( thelist ), i++,
			pvars = pvars || ",:" || thelist[i]
		);
		Eval(
			Parse(
				"obj = dt << Process Capability(
	Process Variables(" || pvars || " ),
	Spec Limits( Import Spec Limits( dt2 ) )
);"
			)
		);
	nw << close window;
	)
);
Jim
jay_S

Occasional Contributor

Joined:

Jun 1, 2017

I think it is my pc that is the problem. Your script looks like it should work and works on your pc. i downloaded your sample tables but on my machine it gives an error/Alert. It looks as your solution works but something else is happening. I think i need to fix the I/O first before im able to implement your solution.

 

 

Capture.PNG

txnelson

Super User

Joined:

Jun 22, 2012

Regardless if you can open the sample data tables or not, the code that I included can be cut an pasted into your JMP session, with the knowledge that it works.  So if you take your own data table and limits table, and the code doesn't work for you, then you need to look towards your data for the issue.

Jim
Byron_JMP

Staff

Joined:

Apr 26, 2012

So, this is quite literally copied and pasted from the Scripting Index. IMHO it is the most simple way of loading specs from one table and saving them into the column properties of another table.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = Capability(Y( :OZONE, :CO, :SO2, :NO ), Spec Limits(Import Spec Limits("$SAMPLE_DATA/CitySpecLimits.jmp")));
obj << Save Spec Limits as Column Properties;

  

...although, I have to say Jim Nelson's add-in is pretty slick and has some very convenient generalized functionality.