I fully understand what you are requesting. However, sometimes features that are available in JMP that are targeted for interactive usage, do not translate very well to the scripting world. The Local Data Filter is one of them. It is really a fantastic interactive tool, but in the script below, you will see that it's usage in a script, just makes the script more complex. And the interactive feature where the different values that are nicely displayed in the filter list, are not available from the filter when used in JSL.
Here is the script using a scripted local data filter
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Get the levels of the Sex column. The Summarize function will
// create a list of the different levels of whatever column is
// specified in the "By" claue
Summarize( dt, GroupBy = By( :Sex ) );
gb = Graph Builder(
invisible,
Size( 517, 437 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Box Plot( X, Y, Legend( 3 ) ) )
);
For( i = 1, i <= N Items( GroupBy ), i++,
gb << Local Data Filter( Add Filter( columns( :Sex ), Where( :sex == GroupBy[i] ) ), Mode( Show( 1 ), Include( 1 ) ) );
If( i == 1,
gb << Save Presentation( "$TEMP/jmp_example2.pptx" ),
gb << Save Presentation( "$TEMP/jmp_example2.pptx", Append )
);
gb << remove data filter;
);
Open( "$TEMP/jmp_example2.pptx" );
Here is the example that I have been using in answering your questions, that does not use the local data filter, and actually gets a better version of the output you want.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Get the levels of the Sex column. The Summarize function will
// create a list of the different levels of whatever column is
// specified in the "By" claue
Summarize( dt, GroupBy = By( :Sex ) );
For( i = 1, i <= N Items( GroupBy ), i++,
gb = dt << Graph Builder(
// The invisible option helps to keep the desktop clean
invisible,
Size( 517, 437 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Box Plot( X, Y, Legend( 3 ) ) ),
// Here is an easy way to subset the data used in the grap
Where( :sex == GroupBy[i] )
);
If(i==1,
gb << Save Presentation( "$TEMP/jmp_example.pptx" ),
gb << Save Presentation( "$TEMP/jmp_example.pptx", Append );
);
);
Open( "$TEMP/jmp_example.pptx" );
The second example is much simpler code
Jim