I made a mistake in the JSL I provided in my last response. I have since then corrected my response.
In this response, I have expanded on your provided JSL, and provided a complete example that will save the subsetted table every time a new Select Rows is specified.
The row state handler is also eliminated when the Partition() window is closed.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );
tableCount = 0;
theRows = [];
f = Function( {a},
// Set dupRows to the previously selected rows
dupRows = theRows;
// Get the current selected rows
theRows = Current Data Table() << get selected rows;
If( N Rows( theRows ) > 0,
// check to see if there are the same number of rows and if yes
// then validate the rows are different rows before saving
If( N Rows( theRows ) == N Rows( dupRows ),
If( Sum( dupRows == theRows ) != N Rows( theRows ),
tableCount++;
dtTemp = dt << subset( invisible, selected rows( 1 ), selected columns( 0 ) );
filepath = "$TEMP";
Close(
dtTemp,
save( filepath || "\" || "part" || Char( tableCount ) || ".jmp" )
);
Current Data Table( dt );
);
,
// If not the same number of selected rows, save the subset
tableCount++;
Show( tableCount );
dtTemp = dt << subset( invisible, selected rows( 1 ), selected columns( 0 ) );
filepath = "$TEMP";
Close( dtTemp, save( filepath || "\" || "part" || Char( tableCount ) || ".jmp" ) );
Current Data Table( dt );
)
);
);
rs = Current Data Table() << make row state handler( f );
obj = Partition(
Y( :NPN1 ),
X( :PNP1, :PNP2, :PNP3, :PNP4, :NPN2, :NPN3, :NPN4 ),
Method( "Decision Tree" ),
Validation Portion( .2 )
);
obj << ShowGraph( 0 );
obj << SplitBest( 4 );
obj << Show Split Count( 1 );
obj << Show Split Prob( 1 );
Wait( .5 );
//obj << Save Predicteds;
obj << on close( Clear Symbols( rs ) );
Jim