Choose Language Hide Translation Bar
Highlighted
matteo_patelmo
Level IV

How to know if data table is private

Hello everybody,

 

I'd like to use the

subscribe to data table list()

function to handle all tables that the user opens during the execution of a script of mine. Since the script is also creating its own private data tables, I need a way to detect whether a data table is private in order to treat it differently from data tables opened by the user.  I have looked for a "is Private" function but could not find it. 

The 

<<has data view()

message is not working as I would like it to. I think this could be related the the fact the data view is created after the "onopen" function of the data table subscription is triggered.

 

thanks for your help!

Matteo

6 REPLIES 6
Highlighted
Craige_Hales
Staff (Retired)

Re: How to know if data table is private

I tried the scripting index example in JMP 15 and changed Big Class to private. It is not seen by open or close, which is what I'd expect. Can you share an example?

Craige
Highlighted
matteo_patelmo
Level IV

Re: How to know if data table is private

Thanks @Craige_Hales

 

Here is an example of what I'm seeing.  It really seems that the fopen function is triggered at the very initial creation of the data table object.

 

names default to here(1);

fopen = Function( {dt}, 
	print(dt<<has data view); // when fopen is triggered, dt never has a data view
	Print( dt <<get name);  // when fopen is triggered, dt does not even yet have even its name!
	close(dt,nosave);  // by closing dt here.. dt is closed .. but its window will open right after!
);

asub = Subscribe to Data Table List( , on open( fopen ) );
dt1 = New Table( "dt1");
dt2 = New Table( "dt2", private );
Unsubscribe to Data Table List( asub, "ALL" );

//close(dt1,nosave);
close(dt2,nosave);
Highlighted
Craige_Hales
Staff (Retired)

Re: How to know if data table is private

I'm pretty sure closing the table during the open leaves JMP 15 in a slightly broken state @audrey_shull . Don't do that; the table names, at a minimum, seem confused afterward. I'm pretty sure the behavior will be different in JMP 16.

I'm also puzzled; neither call back is made here:

does not print "opening" or "closing"does not print "opening" or "closing"

My opinion is that the callbacks should never be made for private data tables. That's part of what private means...they should be hard to observe and mess with. @chungwei 

Craige
Highlighted
matteo_patelmo
Level IV

Re: How to know if data table is private

Hi @Craige_Hales ,

 

you are right, one should not close the table inside the "open" callback function. This is not what I actually need to do, I put it in my example just as a way to explore what was happening, but it's not the key issue.

 

You are also right that when using  "Open(..., private)" , the "open" callback function is not activated.  This is exactly the behavior I would need.

 

But, in my example, I was using  "New Table(..., private)" . In this case the "open" callback function is activated.  This is where I need a way to know that the table is private and to manage it differently.

 

thanks again!

 

Matteo

Highlighted
David_Burnham
Super User

Re: How to know if data table is private

If it is your script that is generating the private tables, then perhaps the easiest way to know if a table is private is to maintain a list of the tables that you are creating; then you can just cross reference that list.

-Dave
Highlighted
matteo_patelmo
Level IV

Re: How to know if data table is private

Hi @David_Burnham ,

 

in fact, I would like to detect all data tables created during execution of my script, but treat differently the private ones (basically doing nothing on them), from the visible ones created by the user.  This cannot be handled by a list, I think.  See also my reply to @Craige_Hales.

 

thanks!
Matteo

Article Labels