cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
PG
PG
Level I

Save new graph instead of overwriting the already saved ones

Hello,

I am working with a huge database like below.

Manufacturer: Product: Model: Quantity

A: X:G1: 1000

 

B: S:F2: 5000

C: Y:N5: 2500

A: R:G5: 6000

and so on..

Now, at the beginning of my query I am filtering the Manufacturer. With the remaining columns, I am doing some calculations and plot some graphs and then save them as an image file. For ex.

pc = graph builder(...);

report(pc) << save picture("D:\Graph.jpg");

 

I have 2 questions related to modification of this script

1. Every time I run the script, the previous saved graph Graph.jpg is being overwritten. Is it possible to save a new graph keeping the old ones intact?

2. Since I am filtering the Manufacturer at the beginning, is it possible to save the graph automatically with a title depending on the chosen manufacturer and today's date, for ex. A_29032018.jpg?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Save new graph instead of overwriting the already saved ones

assumming that your data table variable that contains the manufacturer is called Manufacture, and that every row in the data table contains the "A" or "B" etc. then you can use the following

report(pc) << save picture("D:\" || :Manufacturer[1] || _" || format(today(),"mmddyyyy",8) || ".jpg");

I strongly encourage you to read the Scripting Guide to provide you with the structures and syntax of JSL.  It is available at:

     Help==Books==>Scripting Guide 

Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Save new graph instead of overwriting the already saved ones

The following change should allow you to save the graphs as you said:

report(pc) << save picture("D:\A_" || format(today(),"mmddyyyy",8) || ".jpg");
Jim
PG
PG
Level I

Re: Save new graph instead of overwriting the already saved ones

Hello Jim,

Thanks for your reply.

 

report(pc) << save picture("D:\A_" || format(today(),"mmddyyyy",8) || ".jpg");

 If I re-run the query and filter Manufacturer C this time, I have to manually change the script to 

report(pc) << save picture("D:\C_" || format(today(),"mmddyyyy",8) || ".jpg");

 Is it possible somehow that I can tell the program to find which Manufacturer I have filtered at the beginning and change the name of the file automatically?

txnelson
Super User

Re: Save new graph instead of overwriting the already saved ones

assumming that your data table variable that contains the manufacturer is called Manufacture, and that every row in the data table contains the "A" or "B" etc. then you can use the following

report(pc) << save picture("D:\" || :Manufacturer[1] || _" || format(today(),"mmddyyyy",8) || ".jpg");

I strongly encourage you to read the Scripting Guide to provide you with the structures and syntax of JSL.  It is available at:

     Help==Books==>Scripting Guide 

Jim