cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
rfeick
Level IV

Saving Data Table and Overlay Plot


I have a script that prompts the user to select a txt file then it takes the data from the txt file and puts it into a JMP data table, does some modifications, and creates an overlay plot. I have attached the portion of the script that finds the file then imports the data. The last thing I want the script to do is to save the data table and the overlay plot to the save location where the original txt file was located, but I can't figure out how to make it work.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Saving Data Table and Overlay Plot

Below is an example script that approximates your script, and saves the data table and the report output.  I used the Big Class data table from the $SAMPLE_DATA folder, and saved it as a txt file. 

Names Default To Here( 1 );

filepath = Pick File( "Select Source Data File", "$DESKTOP", {"txt files|txt"} );

dt = Open( filepath );

// Run the Plot, adding a pointer to it, so you can manipulate it later

op = Overlay Plot( X( :age ), Y( :height, :weight ), Y Scale( Left, Right ) );

// Determine the directory to write to

ThePath = Substr( filepath, 1, Contains( filepath, Word( -1, filepath, "/" ) ) - 1 );

// Save the data table

dt << save as( ThePath || "New Data Table.jmp" );

// Save the output.  Here is a jpeg version, but other output

// options are available.  Go to Help==>Scripting Index

// for additional options

Report( op ) << save picture( ThePath || "The Report.jpg" );

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Saving Data Table and Overlay Plot

Below is an example script that approximates your script, and saves the data table and the report output.  I used the Big Class data table from the $SAMPLE_DATA folder, and saved it as a txt file. 

Names Default To Here( 1 );

filepath = Pick File( "Select Source Data File", "$DESKTOP", {"txt files|txt"} );

dt = Open( filepath );

// Run the Plot, adding a pointer to it, so you can manipulate it later

op = Overlay Plot( X( :age ), Y( :height, :weight ), Y Scale( Left, Right ) );

// Determine the directory to write to

ThePath = Substr( filepath, 1, Contains( filepath, Word( -1, filepath, "/" ) ) - 1 );

// Save the data table

dt << save as( ThePath || "New Data Table.jmp" );

// Save the output.  Here is a jpeg version, but other output

// options are available.  Go to Help==>Scripting Index

// for additional options

Report( op ) << save picture( ThePath || "The Report.jpg" );

Jim
rfeick
Level IV

Re: Saving Data Table and Overlay Plot

Thank you for your help! Your solution worked perfectly in my script!