cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
hogi
Level XII

Oops - I lost my data ...

 
8 REPLIES 8
hogi
Level XII

Re: Oops - I lost my data ...

option 1):
add a Link with a non-resolved reference:

 

Names Default to Here(1);

testMode= 1;
dt =  Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << new column("Conan the Destroyer",Set Property("Link Reference", {Reference Table(link_path), Options("Use Linked Column Name", "Auto Open")}));

dt << save("$TEMP/test.jmp");
close(dt, noSave);

open("$TEMP/test.jmp");  
jthi
Super User

Re: How to make a data table non-accessible?

In what sense non-accessible?

-Jarmo
hogi
Level XII

Re: How to make a data table non-accessible?

In the sense of "dead".

hogi
Level XII

Re: How to make a data table non-accessible?

The good thing:
JMP stores the Table reference in plain text ...

By deleting the ", Auto Open" one can revive the file:

hogi_0-1733159175285.png

JMP will show a warning message:

hogi_1-1733159536529.png

and skip the details of the erroneous column.

txnelson
Super User

Re: How to make a data table non-accessible?

What is the purpose of this thread?

Jim
hogi
Level XII

Re: How to make a data table non-accessible?


@txnelson wrote:

What is the purpose of this thread?



mainly: Help people save their work.

 

Besides that:
a) Documentation: Things you should NOT (!!) do with your data table.

b) Motivation:
@ colleagues - please invest 30 minutes to understand the beauty of Eval/Eval Expr/Expr
(the basics: # 62, some examples: #66)  ---  it will save you from lost data like this one.

c) preventive action:

-> I will add a check + warning functionality to the hogi_0-1733168619557.png button ...
if a variable is defined in the script - and the variable shows up in a message (<<  ...) ... show a WARNING !

 

hogi
Level XII

Re: How to make a data table non-accessible?


@hogi wrote:
a check + warning functionality  ...

 


 

 

myscript = Parse( Current Window()[Script Box( 1 )] << get text );
variables = {};
// find the assignments and collect the JSL variables
assigns = Extract Expr All Matches(
	Name Expr( myscript ),
	Expr( Assign( Wild List() ) )
);
For Each( {item}, assigns, Insert Into( variables, Arg( item, 1 ) ) );
// collect the messages
messages = Extract Expr All Matches(
	Name Expr( myscript ),
	Expr(
		Send( Wild(), Wild List() )
	)
);
For Each( {message}, messages, 
// bother an experienced user just when he forgot to use Expr:
	// assuming there is a surrounding Eval (Eval Expr()),  remove all the Expr() - including the content [dirty]
	Extract Expr All Matches(
		Arg( Name Expr( message ), 2 ),
		Expr( Expr( Wild List() ) )
	);  // returns: cleanedExpr, without the Expr()s
	//search for variables
	For Each( {variable, idx}, variables,
		If(
			Not(
				Is Empty(
					Eval(
						Eval Expr(
							Extract Expr(
								Expr(
									Name Expr( cleanedExpr )
								),
								Expr( Name Expr( variable ) )
							)
						)
					)
				)
			),
			Caption(
				Char( variables[idx] ) || " found in a message to " ||
				Char( Arg( Name Expr( message ), 1 ) ) ||
				".\!n Please correct it with Eval(Eval Expr( ... Expr()))"
			);
			Stop();
		)

	
	
	);
);
	
	
//Extract Expr All Matches?
// it works like Extract Expr, but doesn't stop after the first match. 
// saves the "cleaned" expression as cleanedExpr

 

 

jthi
Super User

Re: How to make a data table non-accessible?

Why would you want to make your data non-accessible in such a way that it is basically corrupted?

-Jarmo