Save new graph instead of overwriting the already saved onesHello,
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.
Re: Save new graph instead of overwriting the already saved onesassumming 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
Re: Save new graph instead of overwriting the already saved onesHello Jim,
Thanks for your reply.
<SPAN class="token function">report</SPAN><SPAN class="token punctuation">(</SPAN>pc<SPAN class="token punctuation">)</SPAN> <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> save picture<SPAN class="token punctuation">(</SPAN><SPAN class="token string">"D:\<FONT color="#FF0000"><STRONG>A_</STRONG></FONT>"</SPAN> <SPAN class="token operator">||</SPAN> <SPAN class="token function">format</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token function">today</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token string">"mmddyyyy"</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token number">8</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token operator">||</SPAN> <SPAN class="token string">".jpg"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
If I re-run the query and filter Manufacturer C this time, I have to manually change the script to
<SPAN class="token function">report</SPAN><SPAN class="token punctuation">(</SPAN>pc<SPAN class="token punctuation">)</SPAN> <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> save picture<SPAN class="token punctuation">(</SPAN><SPAN class="token string">"D:\<FONT color="#FF0000">C<STRONG>_</STRONG></FONT>"</SPAN> <SPAN class="token operator">||</SPAN> <SPAN class="token function">format</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token function">today</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token string">"mmddyyyy"</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token number">8</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token operator">||</SPAN> <SPAN class="token string">".jpg"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
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?
Re: Save new graph instead of overwriting the already saved onesThe following change should allow you to save the graphs as you said:
report(pc) << save picture("D:\A_" || format(today(),"mmddyyyy",8) || ".jpg");