cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
jay_S
Level II

Importing Spec Limits

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

Re: Importing Spec Limits

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

View solution in original post

10 REPLIES 10
txnelson
Super User

Re: Importing Spec Limits

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
Level II

Re: Importing Spec Limits

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

Re: Importing Spec Limits

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
Level II

Re: Importing Spec Limits

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

Re: Importing Spec Limits

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
Chily
Level III

Re: Importing Spec Limits

Hi Txnelson,

I try to use your script to run import my limit file but occur error. (attach my limit spec file)

it looks long variable name or character '/' issue, could you help? Thank you.

Chily_0-1666944485497.png

 

Regards,Chily

 

jthi
Super User

Re: Importing Spec Limits

This is fairly old script (and post) and depending on what you are trying to do in the end defines how to modify it (or maybe you should use other script completely or possibly the add-in provided).

 

With the add-in you will have to change Variable columns modeling type from Unstructured Text to Nominal

jthi_0-1666947459883.png

jthi_1-1666947513803.png

 

Below is one fairly quick modification which should work if you have JMP16+ for the script (modifications done to lines 24 and 26):

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] ||"\!"n";
		For( i = 2, i <= N Items( thelist ), i++,
			pvars = pvars || ", :\!"" || thelist[i] ||"\!"n";
		);
		Eval(
			Parse(
				"obj = dt << Process Capability(
	Process Variables(" || pvars || " ),
	Spec Limits( Import Spec Limits( dt2 ) )
);"
			)
		);
	nw << close window;
	)
);
-Jarmo
Chily
Level III

Re: Importing Spec Limits

Thank you, jthi. It works well by your modified script~

Is there any script to load limit file and directly save all limit to column properties?

jthi
Super User

Re: Importing Spec Limits