I can't think of any built-in support for monitoring a local data filter by script.
Below is an hack that simply runs in the background to find filtering changes by the user.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );
f = Function( {ccb},
// Capture the LCL and UCL from the Limit Summaries Outline Box in the Report Output
myLCL = (Report( ccb )["NPN1 Limit Summaries"][Table Box( 1 )][2] << get)[1];
myUCL = (Report( ccb )["NPN1 Limit Summaries"][Table Box( 1 )][4] << get)[1];
// Apply back to the Control Chart the new axis settings
Report( ccb )[Axis Box( 3 )] << Min( myLCL);
Report( ccb )[Axis Box( 3 )] << Max( myUCL);
);
nw=New Window( "Working Example",
Data Filter Context Box(
H List Box(
ldf=dt << Data Filter( local,Add Filter( Columns( :SITE ) ),Mode(select(1),show(1),include(1)) ),
Platform(dt,
ccb = Control Chart Builder(
Size( 534, 453 ),
Show Control Panel( 1 ),
Variables( Y( :NPN1 ) ),
Chart( Position( 1 ), Limits ),
Chart( Position( 2 ) ),
SendToReport(
Dispatch(
{},
"NPN1",
ScaleBox,
{Min( 96.6346153846154 ), Max( 131.634615384615 ), Inc( 5 ), Minor Ticks( 0 ),
Add Ref Line( 104.412948990151, "Solid", "Blue", "LSL", 1 ),
Add Ref Line( 131.893493064355, "Solid", "Blue", "USL", 1 ),
Add Ref Line( 118.153221027253, "Solid", "Blue", "Target", 1 )}
)
)
)
)
)
)
);
// Monitor local data filtering by peeking into the Where Clause below the control Chart
// First locate the Where-clause TextBox
// (the number varies but it seems to always be the last one)
Wait(0);
i = 1;
While(Is Scriptable(Try(parent = nw[Text Box(i)] << parent)),
While(parentType = Char(parent << className) != "OutlineBox", parent = parent << parent);
i++;
);
// Scan for changes with an adequate frequency
filter = "none";
While(Is Scriptable(nw), // Will run until nw is closed
Wait(0.1); // set the scanning frequency here
If(!Is Missing(newfilter = Try(nw[Text Box(i)] << gettext)),
If(filter != newfilter,
filter = nw[Text Box(i)] << gettext;
f(ccb); // get limits and set a axis
)
);
);