Turning Private data tables on and offIn keeping many of my scripts clean, I use 'private' quite a lot. However, if I am troubleshooting a script, having tables as private gets in the way and I need to comment out and hopefully remember to uncomment as I make changes to see if the changes work.
Is there a way, or does JMP already have a global way to turn private tables on or off? In my head I could take the time to make duplicates of my code with and without the private and tie it to a test variable, but that doesn't seem like the best answer.
Wasn't sure if there were any ideas out there on how to do that. Thanks!
ScriptingRe: Turning Private data tables on and offI am not aware of being able to turn Private on and off, since it would require on-the-fly building of all of the display objects in memory. However, you can use the Show Window message to display/hide normal or invisible data tables.
data table("Daily Blood Pressure")<<SHOW window=""></SHOW>Re: Turning Private data tables on and offYou might be able to make private table visible by using << New Data View. I'm not 100% what this does in this context, but it seems to make private tables visible and I have used it for debugging:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp", private);
wait(2);
dt << New Data View;
no idea how to make it private again, but << Show Window(0); will make it invisible at least.
Re: Turning Private data tables on and offVisible and invisible tables are tracked by JMP. You can keep an eye on them in the home window, for example. Private tables are tracked only by the code that creates them. If you fail to close a private table before overwriting the JSL variable holding its handle, the table is still in memory but unreachable. It will be closed when JMP terminates. (Window->CloseAllDataTables can't find the private tables and won't close them.)
I'm also pretty sure JMP does not expose a way to turn a visible or invisible table private. You can turn a private table to an invisible one, if you have the handle, like this:
dtA = Open( "$SAMPLE_DATA/Big Class.jmp", private );
// getting the data box makes it invisible
b = dtA << New Data Box();
// then show window makes it visible
dtA << Show Window;
Unfortunately, the invisible keyword is a keyword and can't be passed as a variable, at least to open(). Not sure about subset, etc. Probably the best you can do is add a call to a user function that does something like above after each point where you create or open a table.
Re: Turning Private data tables on and offThanks everyone! I ended up doing the following which, although not ideal, should work pretty well. I created a function and have a variable at the top of my script to basically turn private on / off
seePrivateTables = 1;
unprivatizeTable = Function({bool,tableName},{default local},
If(bool == 1,
tableName << New Data View;
Return(tableName)
,
Return(tableName)
)
);
// ... various code
dt1 = dt << Summary(.... , private);
dt1 = unprivatizeTable(seePrivateTables, dt1);As long as I remember to call that function when I create new tables, I should be able to turn private tables on and off in bulk.
Re: Turning Private data tables on and offIf you need that function often, you might benefit from creation of Custom function Create Custom Functions, Transforms, and Formats (jmp.com) .This way you can also see the custom function directly from scripting index.