cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • See how to interactively organize and restructure data for analysis. Register for May 29 webinar, 2pm US ET.

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