BookmarkSubscribeRSS Feed

Re: Stack with spec limits

Assaf1

Occasional Contributor

Joined:

Feb 8, 2018

Hi,

How can I perform new table by stack for several columns with spec limits (as properties) and create two new columns with spec low and spec high each Label according to initial table properties?

See attached

If possible, also pass/fail column 

Thanks in advance!

Assaf

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

The best way to learn about this is in the Scripting Guide.  See:

     Help==>Books==>Scripting Guide........Construct a Column Dialog

Jim
4 REPLIES
Highlighted
txnelson

Super User

Joined:

Jun 22, 2012

Here is a simple script that will illustrate one way to do this

Names Default To Here( 1 );
dtOrig = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

// Modify the data to make it simpler for the example
dtOrig << delete columns( 10 :: 132 );
dtOrig << delete columns( 1 :: 4 );
dtOrig << select where( Row() > 50 );
dtOrig << delete rows;

// Stack the data
dtStacked = dtOrig << Stack(
	columns( :NPN1, :PNP1, :PNP2, :NPN2, :PNP3 ),
	Source Label Column( "Parameter" ),
	Stacked Data Column( "Value" ),
	Output Table( "Stacked" )
);

// Create the new columns
dtStacked << New Column( "Lower Spec Limit" );
dtStacked << New Column( "Upper Spec Limit" );

// Move the Spec Limits
colList = dtOrig << get column names( string );
For( i = 1, i <= N Items( colList ), i++,
	specs = Column( dtOrig, colList[i] ) << get property( "spec limits" );
	foundRows = dtStacked << get rows where( dtStacked:Parameter == colList[i] );
	dtStacked:Lower Spec Limit[foundRows] = specs["LSL"];
	dtStacked:Upper Spec Limit[foundRows] = specs["USL"];
);
Jim
Assaf1

Occasional Contributor

Joined:

Feb 8, 2018

Thanks a lot!!

Using your support I performed the follows script:

  • BTW, How can I add popup window to modify the red line?

@txnelson wrote:

Here is a simple script that will illustrate one way to do this

Names Default To Here( 1 );
dtOrig = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

// Modify the data to make it simpler for the example
dtOrig << delete columns( 10 :: 132 );
dtOrig << delete columns( 1 :: 4 );
dtOrig << select where( Row() > 50 );
dtOrig << delete rows;

// Stack the data
dtStacked = dtOrig << Stack(
	columns( :NPN1, :PNP1, :PNP2, :NPN2, :PNP3 ),
	Source Label Column( "Parameter" ),
	Stacked Data Column( "Value" ),
	Output Table( "Stacked" )
);

// Create the new columns
dtStacked << New Column( "Lower Spec Limit" );
dtStacked << New Column( "Upper Spec Limit" );

// Move the Spec Limits
colList = dtOrig << get column names( string );
For( i = 1, i <= N Items( colList ), i++,
	specs = Column( dtOrig, colList[i] ) << get property( "spec limits" );
	foundRows = dtStacked << get rows where( dtStacked:Parameter == colList[i] );
	dtStacked:Lower Spec Limit[foundRows] = specs["LSL"];
	dtStacked:Upper Spec Limit[foundRows] = specs["USL"];
);

// Stack the data
dtOrig = currentdatatable();
dtStacked = dtOrig << Stack(
columns( 26 :: 42 ),
Source Label Column( "Parameter" ),
Stacked Data Column( "Value" ),
Output Table( "Stacked" )
);

// Create the new columns
dtStacked << New Column( "Lower Spec Limit" );
dtStacked << New Column( "Upper Spec Limit" );

// Move the Spec Limits
colList = dtOrig << get column names( string );
For( i = 1, i <= N Items( colList ), i++,
specs = Column( dtOrig, colList[i] ) << get property( "spec limits" );
foundRows = dtStacked << get rows where( dtStacked:Parameter == colList[i] );
dtStacked:Lower Spec Limit[foundRows] = specs["LSL"];
dtStacked:Upper Spec Limit[foundRows] = specs["USL"];
);
New Column("P/F", Numeric, "Continuous", Formula((:Lower Spec Limit <= :Value <= :Upper Spec Limit) == 0));

txnelson

Super User

Joined:

Jun 22, 2012

Solution

The best way to learn about this is in the Scripting Guide.  See:

     Help==>Books==>Scripting Guide........Construct a Column Dialog

Jim
Assaf1

Occasional Contributor

Joined:

Feb 8, 2018

Thanks a lot!