- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Saving Data Table and Overlay Plot
Thank you for your help! Your solution worked perfectly in my script!