Ce script attribuera « Manquant » dans la colonne finale « Row Réussite/Échec » si une ou plusieurs valeurs sont manquantes.
foundCols = "";
// Loop across the columns and generate the test pass/fails
For( i = 1, i <= N Items( colList ), i++,
spec = Column( EVALdt, colList[i] ) << get property( "Spec Limits" );
EVALdt << clear select;
If( Is Empty( spec ) == 0,
EVALdt << New Column( (Column( EVALdt, colList[i] ) << get name) || " Pass/Fail" );
If( Is Missing( Try( spec["LSL"], . ) ) == 0,
EVALdt << select where( As Column( EVALdt, colList[i] ) < spec["LSL"] );
Try( Column( EVALdt, N Cols( EVALdt ) )[EVALdt << get selected rows] = 0 );
);
If( Is Missing( Try( spec["USL"], . ) ) == 0,
EVALdt << select where( As Column( EVALdt, colList[i] ) > spec["USL"], current selection( "extend" ) );
Try( Column( EVALdt, N Cols( EVALdt ) )[EVALdt << get selected rows] = 0 );
);
EVALdt << select where( IsMissing( As Column( EVALdt, colList[i] ) ), current selection( "extend" ) );
EVALdt << invert row selection;
Try( Column( EVALdt, N Cols( EVALdt ) )[EVALdt << get selected rows] = 1 );
Column( EVALdt, N Cols( EVALdt ) ) << set property( "Value Labels", {0 = "Fail", 1 = "Pass"} );
If( foundCols == "",
foundCols = ":Name(\!"" || (Column( EVALdt, colList[i] ) << get name) || " Pass/Fail\!")",
foundCols = foundCols || ", " || ":Name(\!"" || (Column( EVALdt, colList[i] ) << get name) || " Pass/Fail\!")"
);
);
);
// Create the Row Missing/Pass/Fail
Eval( Parse( "EVALdt << New Column( \!"Row Pass/Fail\!", formula( If( N Missing("||foundCols||") > 1, \!"Missing\!", Min(" || foundCols || " ) == 1, \!"Pass\!", \!"Fail\!" ) ))" ) );Vous trouverez ci-dessous un script très basique, mais un bon point de départ pour le développement d'un calculateur de rendement interactif.Votre exigence est une idée très intéressante.Peut-être pouvez-vous développer et ajouter un nouveau complément à File Exchange, ou peut-être que quelqu'un d'autre le fera.Mais voici mon script de point de départ :
Names Default To Here( 1 );
// Create a sample data table
dt = New Table( "Yield",
Add Rows( 40 ),
New Column( "Parm 1",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Property( "Spec Limits", {LSL( 57 ), USL( 67 ), Show Limits( 0 )} ),
Set Values(
[59, 61, 55, 66, 52, 60, 61, 51, 60, 61, 56, 65, 63, 58, 59, 61, 62, 65, 63, 62, 63, 64, 65, 64, 68, 64, 69, 62, 64, 67, 65, 66,
62, 66, 65, 60, 68, 62, 68, 70]
)
),
New Column( "Parm 2",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Property( "Spec Limits", {LSL( 80 ), USL( 140 ), Show Limits( 0 )} ),
Set Values(
[95, 123, 74, 145, 64, 84, 128, 79, 112, 107, 67, 98, 105, 95, 79, 81, 91, 142, 84, 85, 93, 99, 119, 92, 112, 99, 113, 92, 112,
128, 111, 105, 104, 106, 112, 115, 128, 116, 134, 172]
)
),
New Column( "Parm 1 Pass/Fail",
Numeric,
"Continuous",
Format( "Best", 12 ),
Value Labels( {0 = "Fail", 1 = "Pass"} ),
Use Value Labels( 1 ),
Set Values(
[1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0]
)
),
New Column( "Parm 2 Pass/Fail",
Numeric,
"Continuous",
Format( "Best", 12 ),
Value Labels( {0 = "Fail", 1 = "Pass"} ),
Use Value Labels( 1 ),
Set Values(
[1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]
)
)
);
// A function to set the Pass/Fail columns based upon the current Spec Limits
setPassFail = Function( {Parm},
USL = (Column( dt, parm ) << get property( "Spec Limits" ))["USL"];
LSL = (Column( dt, parm ) << get property( "Spec Limits" ))["LSL"];
Column( dt, parm || " Pass/Fail" )[dt << get rows where( As Column( dt, parm ) >= LSL & As Column( dt, parm ) <= USL )] = 1;
Column( dt, parm || " Pass/Fail" )[dt << get rows where( As Column( dt, parm ) < LSL | As Column( dt, parm ) > USL )] = 0;
);
//Calculate the yield for all Pass/Fail columns
calculateYield = Function( {},
overallYield = 0;
numberOfRowsThatPassed = 0;
numberOfRowsThatFailed = 0;
For( i = 1, i <= N Rows( dt ), i++,
If( Sum( :Name( "Parm 1 Pass/Fail" )[i], :Name( "Parm 2 Pass/Fail" )[i] ) == N Items( colNamesList ),
numberOfRowsThatPassed++,
numberOfRowsThatFailed
++)
);
overallYield = numberOfRowsThatPassed / (numberOfRowsThatPassed + numberOfRowsThatFailed);
);
// Display the Yield Changing Window
nw = New Window( "Interactive Yield Calculation",
Lineup Box( N Col( 2 ),
V List Box(
Text Box( "Parm 1" ),
p1Upper = Col Maximum( :Name( "Parm 1" ) );
p1Lower = Col Minimum( :Name( "Parm 1" ) );
p1 = Range Slider Box(
Col Mean( :Name( "Parm 1" ) ) - 6 * Col Std Dev( :Name( "Parm 1" ) ),
Col Mean( :Name( "Parm 1" ) ) + 6 * Col Std Dev( :Name( "Parm 1" ) ),
p1Lower,
p1Upper,
Eval(
Substitute(
Expr(
:Name( "Parm 1" ) << set property( "Spec Limits", {LSL( _LSL_ ), USL( _USL_ ), Show Limits( 0 )} )
),
Expr( _LSL_ ), p1Lower,
Expr( _USL_ ), p1Upper
)
);
returned = setPassFail( "Parm 1" );
cYield = calculateYield();
yieldVal << set( cYield );
);,
Text Box( "Parm 2" ),
p2Upper = Col Maximum( :Name( "Parm 2" ) );
p2Lower = Col Minimum( :Name( "Parm 2" ) );
p2 = Range Slider Box(
Col Mean( :Name( "Parm 2" ) ) - 6 * Col Std Dev( :Name( "Parm 2" ) ),
Col Mean( :Name( "Parm 2" ) ) + 6 * Col Std Dev( :Name( "Parm 2" ) ),
p2Lower,
p2Upper,
Eval(
Substitute(
Expr(
:Name( "Parm 2" ) << set property( "Spec Limits", {LSL( _LSL_ ), USL( _USL_ ), Show Limits( 0 )} )
),
Expr( _LSL_ ), p2Lower,
Expr( _USL_ ), p2Upper
)
);
returned = setPassFail( "Parm 2" );
cYield = calculateYield();
yieldVal << set( cYield );
);,
),
V List Box( Text Box( "Yield" ), yieldVal = Number Edit Box() )
),
cYield = calculateYield();
yieldVal << set( cYield );
);Voici un script qui créera de nouvelles colonnes contenant numériquement 0/1 et s'affichera comme Échec/Réussite
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Semiconductor Capability.jmp" );
// Get all numeric columns
colList = dt << get column names( numeric, string );
foundCols = "";
// Loop across the columns and generate the test pass/fails
For( i = 1, i <= N Items( colList ), i++,
spec = Column( dt, colList[i] ) << get property( "Spec Limits" );
dt << clear select;
If( Is Empty( spec ) == 0,
dt << New Column( (Column( dt, colList[i] ) << get name) || " Pass/Fail" );
If( Is Missing( Try( spec["LSL"], . ) ) == 0,
dt << select where( As Column( dt, colList[i] ) < spec["LSL"] );
Try( Column( dt, N Cols( dt ) )[dt << get selected rows] = 0 );
);
If( Is Missing( Try( spec["USL"], . ) ) == 0,
dt << select where( As Column( dt, colList[i] ) > spec["USL"], current selection( "extend" ) );
Try( Column( dt, N Cols( dt ) )[dt << get selected rows] = 0 );
);
dt << invert row selection;
Try( Column( dt, N Cols( dt ) )[dt << get selected rows] = 1 );
Column( dt, N Cols( dt ) ) << set property( "Value Labels", {0 = "Fail", 1 = "Pass"} );
If( foundCols == "",
foundCols = ":Name(\!"" || (Column( dt, colList[i] ) << get name) || " Pass/Fail\!")",
foundCols = foundCols || ", " || ":Name(\!"" || (Column( dt, colList[i] ) << get name) || " Pass/Fail\!")"
);
);
);
// Create the Row Pass/Fail
Eval( Parse( "dt << New Column( \!"Row Pass/Fail\!", formula( If( Min(" || foundCols || " ) == 1, 1, 0 ) )" ) );