cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

Turning Private data tables on and off

nathan-clark
Level VI

In 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!

12 REPLIES 12
nathan-clark
Level VI


Re: Turning Private data tables on and off

Yes! That's definitely on my radar. I have a library of functions/utilities I keep a lot of that stuff on hand (and distribute), and shifting to the custom function aspect is one plan long term for many of the more dynamic functions.

vince_faller
Super User (Alumni)


Re: Turning Private data tables on and off

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
Vince Faller - Predictum
nathan-clark
Level VI


Re: Turning Private data tables on and off

That's excellent, Vince! It's similar to what I ended up doing, but it's much more elegant in allowing the dataview to go both ways.