- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Yield Table
I am trying to get a Yield table using a table having embedded spec limits.
For some reason the count of rows part isn't giving anything but zero. Any clue what I'm doing wrong
Clear Globals();
dt = Current Data Table();
dtYield = New Table( "Yield Table",
New Column( "Column Name", Character, "Nominal" ),
New Column( "Pass Count", Numeric, "Continuous" ),
New Column( "Fail Count", Numeric, "Continuous" ),
New Column( "Yield (Percent)", Numeric, "Continuous", Format( "Percent", 12 ) )
);
// Get all numeric columns
colList = dt << get column names( numeric, string );
// Loop across the columns and generate the test pass/fails
Try(For( i = 1, i <= N Items( colList ), i++,
spec = As Column( dt, colList[i] ) << get property( "Spec Limits" );
//Establish the Notes Value from the Parent Column
dt << clear select;
If( !Is Empty( specs ),
/* Extract spec limits */
lsl = spec["LSL"]; // Lower Spec Limit
usl = spec["USL"]; // Upper Spec Limit
/* Step 5: Evaluate pass and fail counts */
failCount = N Rows( dt << Get Rows Where( Column(dt, colList[i]) <= lsl)) + N Rows( dt << Get Rows Where( Column(dt, colList[i]) >= usl));
passCount = N Rows( dt << Get Rows Where( Column(dt, colList[i]) > lsl & Column(dt, colList[i]) < usl ) );
/* Step 6: Calculate yield */
yield = 100 * passCount / (passCount + failCount);
Show(yield);
/* Step 7: Add results to the yield table */
dtYield << Add Rows(1);
dtYield:Column Name[ N Rows( dtYield ) ] = As Column(colList[i]) << Get Name();
dtYield:Pass Count[ N Rows( dtYield ) ] = passCount;
dtYield:Fail Count[ N Rows( dtYield ) ] = failCount;
dtYield:Yield (Percent)[ N Rows( dtYield ) ] = yield;
);
););
Slán
SpannerHead
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Yield Table
I came up with this if anyone has a better suggestion?
Clear Globals();
dt = Current Data Table();
dtYield = New Table( "Yield Table",
Add Rows(1),
New Column( "Column Name", Character, "Nominal" ),
New Column( "Pass Count", Numeric, "Continuous" ),
New Column( "Fail Count", Numeric, "Continuous" ),
New Column( "Yield", Numeric, "Continuous" ),
);
// Get all numeric columns
colList = dt << get column names( numeric, string );
SpecCols ={};
For Each({colnames, index}, colList,
spec = Column(dt, colnames) << get property( "Spec Limits" );
If( !Is Empty( spec ), Insert Into (SpecCols, colnames)));
// Loop across the columns and generate the test pass/fails
For Each({colnames, index}, SpecCols,
spec = Column(dt, colnames) << get property( "Spec Limits" );
lsl = spec["LSL"]; // Lower Spec Limit
usl = spec["USL"]; // Upper Spec Limit
failCount = N Rows( dt << Get Rows Where((As Column(dt, colnames)[]<lsl) | (As Column(dt, colnames)[]>usl)));
passCount = N Rows( dt << Get Rows Where((As Column(dt, colnames)[]>lsl) & (As Column(dt, colnames)[]<usl)));
yield = 100 * passCount / (passCount + failCount);
show(failCount);
show(passCount);
show(yield);
dtYield:Column Name[ N Rows( dtYield ) ] = As Column(dt, colnames) << Get Name();
dtYield:Pass Count[ N Rows( dtYield ) ] = passCount;
dtYield:Fail Count[ N Rows( dtYield ) ] = failCount;
dtYield:Yield[ N Rows( dtYield ) ] = yield;
Data Table ( "Yield Table" ) << Add Rows(1);
);
Slán
SpannerHead
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Yield Table
Tweaked that to have a selectable Yield Threshold.
ex = New Window( "Enter % Pass Threshold",
<<modal,
Panel Box( "Tabulate Parameters Below Threshold",
H List Box( Text Box( "% Pass:" ), teb = Number Edit Box() )
),
teb << Set Width( 5 ),
Panel Box( "Options",
H List Box(
ok_button = Button Box( "OK", na = teb << get text ),
canc_button = Button Box( "Cancel" )
)
)
);
If( ex["Button"] == -1,
teb = Empty();
Throw();
);
colList = dt << get column names( numeric, string );
SpecCols = {};
PctPass = {};
For Each({colnames, index}, colList,
spec = Column(dt, colnames) << get property( "Spec Limits" );
If( !Is Empty( spec ), Insert Into (SpecCols, colnames)));
Failcols = {};
// Loop across the columns and generate the test pass/fails
For Each({colnames, index}, SpecCols,
spec = Column(dt, colnames) << get property( "Spec Limits" );
lsl = spec["LSL"]; // Lower Spec Limit
usl = spec["USL"]; // Upper Spec Limit
failCount = N Rows( dt << Get Rows Where((As Column(dt, colnames)[]<lsl) | (As Column(dt, colnames)[]>usl)));
passCount = N Rows( dt << Get Rows Where((As Column(dt, colnames)[]>lsl) & (As Column(dt, colnames)[]<usl)));
yield = 100 * passCount / (passCount + failCount);
if(yield < Num( na ),
Insert Into( Failcols, colnames );
if(yield < Num( na ),
Insert Into( PctPass, yield )
);
);
);
Show( Failcols );
New Table( "Prevalent Failures",
Add Rows( 0 ),
New Column( "Failing Parameters", Character, "Nominal", Set Values( Failcols ) ),
New Column( "% Passing",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( PctPass )
)
);
Slán
SpannerHead
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Yield Table
I came up with this if anyone has a better suggestion?
Clear Globals();
dt = Current Data Table();
dtYield = New Table( "Yield Table",
Add Rows(1),
New Column( "Column Name", Character, "Nominal" ),
New Column( "Pass Count", Numeric, "Continuous" ),
New Column( "Fail Count", Numeric, "Continuous" ),
New Column( "Yield", Numeric, "Continuous" ),
);
// Get all numeric columns
colList = dt << get column names( numeric, string );
SpecCols ={};
For Each({colnames, index}, colList,
spec = Column(dt, colnames) << get property( "Spec Limits" );
If( !Is Empty( spec ), Insert Into (SpecCols, colnames)));
// Loop across the columns and generate the test pass/fails
For Each({colnames, index}, SpecCols,
spec = Column(dt, colnames) << get property( "Spec Limits" );
lsl = spec["LSL"]; // Lower Spec Limit
usl = spec["USL"]; // Upper Spec Limit
failCount = N Rows( dt << Get Rows Where((As Column(dt, colnames)[]<lsl) | (As Column(dt, colnames)[]>usl)));
passCount = N Rows( dt << Get Rows Where((As Column(dt, colnames)[]>lsl) & (As Column(dt, colnames)[]<usl)));
yield = 100 * passCount / (passCount + failCount);
show(failCount);
show(passCount);
show(yield);
dtYield:Column Name[ N Rows( dtYield ) ] = As Column(dt, colnames) << Get Name();
dtYield:Pass Count[ N Rows( dtYield ) ] = passCount;
dtYield:Fail Count[ N Rows( dtYield ) ] = failCount;
dtYield:Yield[ N Rows( dtYield ) ] = yield;
Data Table ( "Yield Table" ) << Add Rows(1);
);
Slán
SpannerHead
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Yield Table
Tweaked that to have a selectable Yield Threshold.
ex = New Window( "Enter % Pass Threshold",
<<modal,
Panel Box( "Tabulate Parameters Below Threshold",
H List Box( Text Box( "% Pass:" ), teb = Number Edit Box() )
),
teb << Set Width( 5 ),
Panel Box( "Options",
H List Box(
ok_button = Button Box( "OK", na = teb << get text ),
canc_button = Button Box( "Cancel" )
)
)
);
If( ex["Button"] == -1,
teb = Empty();
Throw();
);
colList = dt << get column names( numeric, string );
SpecCols = {};
PctPass = {};
For Each({colnames, index}, colList,
spec = Column(dt, colnames) << get property( "Spec Limits" );
If( !Is Empty( spec ), Insert Into (SpecCols, colnames)));
Failcols = {};
// Loop across the columns and generate the test pass/fails
For Each({colnames, index}, SpecCols,
spec = Column(dt, colnames) << get property( "Spec Limits" );
lsl = spec["LSL"]; // Lower Spec Limit
usl = spec["USL"]; // Upper Spec Limit
failCount = N Rows( dt << Get Rows Where((As Column(dt, colnames)[]<lsl) | (As Column(dt, colnames)[]>usl)));
passCount = N Rows( dt << Get Rows Where((As Column(dt, colnames)[]>lsl) & (As Column(dt, colnames)[]<usl)));
yield = 100 * passCount / (passCount + failCount);
if(yield < Num( na ),
Insert Into( Failcols, colnames );
if(yield < Num( na ),
Insert Into( PctPass, yield )
);
);
);
Show( Failcols );
New Table( "Prevalent Failures",
Add Rows( 0 ),
New Column( "Failing Parameters", Character, "Nominal", Set Values( Failcols ) ),
New Column( "% Passing",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( PctPass )
)
);
Slán
SpannerHead
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Yield Table
Hi there,
If you're working with spec limits and yield tables, there's actually a short tutorial that shows how this can be done without scripting — in case you're looking for a more ready-to-use approach.
https://www.youtube.com/watch?v=1CjmA2hZhdg&t=315s
YieldOptiX is a JMP-based add-in that automates spec limit handling, yield summaries, and binning reports. It's typically used with test data, but the same ideas apply to any structured dataset with specs and measurements.
Just thought I’d share in case you're interested in exploring something more turn-key alongside your own workflows.