Nathan, is this helpful at all?
Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
privateTable = Function({bool,dt},{default local},
table_name = dt << Get Name;
If(!bool & !(dt << HasDataView), // no table but you want one
print("making "||table_name||" public");
dt << New Data View;
Return(dt);
, // elif
bool & dt << HasDataView, // you have a table but want it private
print("making "||table_name||" private");
dt_sub = dt << Subset( All rows, Selected columns only( 0 ), "private" );
close(dt, no save);
dt_sub << Set Name(table_name);
return(dt_sub);
, // else just return what's given
print("passthrough");
return(dt);
)
);
dt = privateTable(1, dt); // should make it private
wait(2);
dt = privateTable(1, dt); // should do nothing
wait(2);
dt = privateTable(0, dt); // should do make it visible
wait(2);
dt = privateTable(1, dt); // should do make it private again