cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
godfeatha
Level I

JMP12 vs JMP14 close command while saving

Hello, 

I've recently moved to JMP14 and have some scripts that stop working due to "invalid argument in access or evaluation of 'Close'". 

Basically in JMP12 if I wanted to close table ABC and save it as a csv file, I'd use the following command:

close(data table ("ABC") << save("\C:\Temp\ABC.csv"));

In JMP14, I cannot do this anymore. Does anyone know what would be the equivalent to this command in JMP14 (without having to save it with 1 command and close it with another). 

 

Thanks in advance, Eliav. 

2 REPLIES 2
txnelson
Super User

Re: JMP12 vs JMP14 close command while saving

close(data table ("ABC"),  save("\C:\Temp\ABC.csv") );
Jim
Craige_Hales
Super User

Re: JMP12 vs JMP14 close command while saving

Jim's answer is correct.

 

So, what changed? JMP 13 or 14 added a return code to the <<save message.

 

dt = open("$sample_data/big class.jmp");
x = dt<<save("$desktop/big class.jmp");
show(x); // 1

The C++ developer decides to return a value (like 1 for <<save in JMP 14), or not, for each message. If no value is returned (like in JMP 12) then the OBJ is returned. I don't like that it works that way, because it makes it hard to fix the language later, as you've discovered. Adding a return code to tell if the save succeeded caused your JSL to fail because you depended on the default behavior that returned the data table object from <<save.

 

Anyone still reading: writing JSL that chains more than one method and checks for the result is also a potential problem. Don't use chaining, and don't depend on the default behavior to help future-proof your JSL:

 

dt = Open( "$sample_data/big class.jmp" );
// prefer to send messages one at a time. Three messages:
x = dt << getname; Write( Eval Insert( "\!ngetname ^x^" ) ); // big class x = dt << save( "$desktop/big class.jmp" ); Write( Eval Insert( "\!nsave ^x^" ) ); // 1 x = dt << end data update; Write( Eval Insert( "\!nend data update ^x^ ^x<<getname^" ) ); // Scriptable[] (this is the default, dt is copied into x) // don't do this, can you guess what x will be? same three messages...chained together x = dt << getname << save( "$desktop/big class.jmp" ) << end data update; Write( Eval Insert( "\!nWhat will the answer be? ^x^" ) );

(I don't have JMP before 14, but I think this will be correct...)

The answer to the chained question where << is used three times will depend on the version of JMP. The <<getname will set a answer in JMP 12 and 14. In 14, the <<save will overwrite the answer. The <<EndDataUpdate uses the default behavior, but that only applies if there is no other answer. Confused? Don't chain.

 

Craige