cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
hogi
Level XI

Private yes/no?

When I open a data table, I can use the option private to hide the data table:

dt = Open( "$SAMPLE_DATA/Big Class.jmp", private );

 

The same feature is also available for table operations like Subset, Concatenate, and so on:

Data Table( "Big Class" ) << subset(1, Private)
Data Table( "Big Class" ) << Concatenate( Data Table( "Big Class" ), Private);

For MFI, there no such option
... up to now, but a strong demand by the community:

Private option for Import Multiple Files 

 

In my Scripts, while debugging, I like to see the data tables, so I added:

//developerIsHere = 1
loadPrivate = If( Is Empty( developerIsHere ),1,0); // default: 1; for debugging automatically set to 0
dt = Open( "$SAMPLE_DATA/Big Class.jmp", private(loadPrivate ) );

with the idea:

As a developer, I can execute the developerIsHere = 1 behind the //
then the data table is opened with the option private(0) and I can see the data table and debug the code.

 

Surprisingly, 

Data Table( "Big Class" ) << subset(1, private(loadPrivate ) )

doesn't "work", the table is always opened in private mode - independent of the current value of loadPrivate. Seems that table operations react on the presence of Private  - independent of the argument.

Just try the following commands:

current data table() << subset(1,Private(1));
current data table() << subset(1,Private(0));
current data table() << subset(1,Private("has no effect"));

All of them have the same effect - the subset is opened in Private mode.

 

Hm.
Is there some documentation about the differences between Private and Private?

 

Is there something less complicated which does the same as:

Eval(Substitute(Expr(current data table() << Subset( 1,__p__)),Expr(__p__),If(loadPrivate,Expr(Private),1)));


TS-00127556 
Tiny-Traps-in-Jmp-and-JSL 

1 REPLY 1
jthi
Super User

Re: Private yes/no?

I think a mess with expressions is only fairly simple option you have

Names Default To Here(1);
DEBUG = 1;
If(IsEmpty(DEBUG),
	TABLE_VISIBILITY = "Visible";
, DEBUG == 1,
	TABLE_VISIBILITY = "Private";
, // else
	TABLE_VISIBILITY = "Visible";
);

dt = Eval(EvalExpr(Open("$SAMPLE_DATA/Big Class.jmp", Expr(TABLE_VISIBILITY))));
dt_subset = Eval(EvalExpr(dt << Subset(dt, Expr(TABLE_VISIBILITY))));

dt_new = New Table("MyTable", Visibility(TABLE_VISIBILITY));

Show(dt, dt_subset, dt_new);

Maybe if all the messages/functions related to table creation didn't just use <Private>, <Invisible> optional arguments but rather had <Visibility("Visible"|"Invisible"|"Private")> as argument (like new table) something like this could be easier.

-Jarmo