cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
ramisola
Level I

How to Save Queried Data Table to a Specified Folder through script?

Hi! Does anyone here knows how to save a queried data table to a specified folder through jmp script? Can't seem to find the right way in doing it... Thanks in advance!

Here's my sample script:

Data Table( "name of data table" );


//save raw data table to a folder

dt = current data table ();
filepath = "C:\Users\folder path";
dt<< save(filepath || "name of data table.jmp");

2 REPLIES 2
txnelson
Super User

Re: How to Save Queried Data Table to a Specified Folder through script?

I suspect the issue is that there is a "/" missing between your filepath and "name of data table.jmp".  Below is a working script that 

Names Default To Here( 1 );
Open( "$SAMPLE_DATA\big class.jmp" );

dt = Data Table( "big class" );
filepath = "$TEMP";

Wait( 5 ); // placed for the example so the table will be visible

dt << save( filepath || "\" || "mytable.jmp" );

Close( dt, nosave );

Wait( 5 );  // placed so for the example one can see the table is closed

Open( filepath || "\" || "mytable.jmp" );
Jim
Craige_Hales
Super User

Re: How to Save Queried Data Table to a Specified Folder through script?

Yes. Most of the time it seems to work better to keep a trailing slash on a path:

 

path = "$temp/mywork/";

Most (all?) functions that need just a path, without a file, are happy with it:

 

 

path = "$temp/mywork/";
show(convertFilePath(path,"windows"));

Convert File Path(path, "windows") = "C:\Users\v1\AppData\Local\Temp\mywork\";

 

and it is clearly not a full filename to anyone looking at the code later.

 

 

Craige

Recommended Articles