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
The best way to learn about this is in the Scripting Guide. See:
Help==>Books==>Scripting Guide........Construct a Column Dialog
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"];
);
Thanks a lot!!
Using your support I performed the follows script:
@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));
The best way to learn about this is in the Scripting Guide. See:
Help==>Books==>Scripting Guide........Construct a Column Dialog
Thanks a lot!