BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
Jaz
Jaz
Community Trekker

Different Outputs When I run the Script Again

Hi,

 

I have a script that manipulates my data table. When I run the script again and the manipulated data table is open the script runs on the already manipulated data table, even though I haven't saved that data table with the same file name as the original. Is there any way to stop this from happening and to only run the script on the original data table? Any help would be appreciated.

0 Kudos
4 REPLIES 4

Re: Different Outputs When I run the Script Again

Are you able to share your script?

 

If your script is manipulating the current data table (as opposed to sending messages to a data table reference), it's possible that when you run the script the second time, the original data table is no longer the current data table.

Michael Crotty
Sr Statistical Writer
JMP Development
Jaz
Jaz
Community Trekker

Re: Different Outputs When I run the Script Again

This script, for example:

dn = Open("Numbers.jmp");
Current Data Table(dn); 
Column("Numbers");
colNumbers = Column(1); 
Column(dn, "Numbers") << Data Type( Numeric );
For Each Row(
	dn:colNumbers = dn:colNumbers + 1; 
); 
	

 It keeps incrementing each row by one each time I run the script. But I didn't save the data table the first time I ran the script so why does it increment the unsaved data table? Are you suggesting that because the first time I ran the script the data table is the current data table and that's why it updates the current data table instead of the original? If so, how could I make it so each time I run the script it only manipulates the original data table?

0 Kudos
Jeff_Perkinson
Community Manager Community Manager

Re: Different Outputs When I run the Script Again

Open() doesn't re-open an already open file.

 

If you want to revert to the saved version of the table, you'll need to close it without saving it before you open it again.

-Jeff
gzmorgan0
Super User

Re: Different Outputs When I run the Script Again

Jeff,

When I read the documentation on the option Force Refresh that only applies to .jrn.jsl.jrp, or .jmpappsource files, I always wondered why JMP decided not to apply it to .jmp files, or have an option Force Refresh Close, that forces all dependent windows to close.  In my opinion, this would be a useful option, especially when developing an application or debugging a script.