I made some minor changes *) - have to check what actually fixed the issue - did it?
- use the column switcher of the Distribution report and get a handle via report layer
- define setUpTableSelect
as a function with 1 argument, such that it can be directly used as function call from make row state handler
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
dt << clear column selection() << clear select();
dt << Data Filter(
Mode( Select( 0 ), Include( 1 ) ),
Add Filter( columns( :lot_id ), Display( :lot_id, N Items( 13 ) ) )
);
colList = {:NPN1, :PNP1, :PNP2, :NPN2, :PNP3};
Eval(
Eval Expr(
win1 = New Window( "Parametric Test Summary Report",
pc = dt << Process Capability(
Process Variables( Expr( colList ) ),
Moving Range Method( Average of Moving Ranges ),
Capability Box Plots( 0 ),
Within Sigma Summary Report( 1 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
Process Performance Plot( 0 ),
Automatic Recalc( 1 ),
SendToReport(
Dispatch(
{"Within Sigma Capability Summary Report"},
"",
TableBox,
{Sort By Column( 14, 1 )}
)
)
),
tb = Text Box(
" Parameter distribution will appear below here. Select a row to show distribution for that parameter. \!N",
<<set wrap( 1000 )
),
H List Box(
Distribution(
Stack( 1 ),
Continuous Distribution(
Column( Expr( colList[1] ) ),
Horizontal Layout( 1 ),
Always use column properties( 1 ),
Vertical( 0 ),
Count Axis( 1 ),
Outlier Box Plot( 0 ),
Normal Quantile Plot( 1 ),
Process Capability( Use Column Property Specs )
),
Column Switcher(
Expr( colList[1] ),
Expr( colList ),
Title( "choose column" )
),
Automatic Recalc( 1 )
)
)
)
)
);
cs = (Current Report()["choose column"]<< get scriptable object);
setUpTableSelect = Function({x},
Print( 1 );
pct = Report( pc )[Table Box( 1 )];
pct << set click sort( 1 );
Try( pct[Number Col Box( "Cpm" )] << delete( 1 ) );
Wait( 0 );
pct << set height( 250 );
win1 << move window( 0, 0 );
pct << set row change function(
Function( {this},
selRow = this << get selected rows();
If( N Items( selRow ) > 1,
Throw( "Only select a single row" ),
Show( col1 = dt << get selected columns() );
cs << set current( Char( col1[1] ) );
);
dt << clear column selection();
)
);
);
setUpTableSelect(1);
rs = dt << make row state handler( setUpTableSelect );