Hi All,
I'm updating a script that I've been working on that after the analysis is done, I want to save a picture of the report window and then save a script to the data table that will open the image if the user wants to do that. Each analysis will generate a new report image, and I need the script saved to the data table reference that updated file name (all are in the same directory).
Side note: I have to save the report as an image because I have some temporary data tables that are referenced in the creation of the report, and I don't want to save those data tables -- although saving them to the data table script would also be cool if someone has a solution for that.
Anyway, what I'm having a hard time with is when the New Script is saved to the data table, it writes the variables in my main script, not the characters that I want. I have tried Eval Insert(), and Eval(Substitute(Expr())) as ways to try and get that, but nothing works.
Below is an example of one such output from the analysis:
![SDF1_0-1692723771557.png SDF1_0-1692723771557.png](https://community.jmp.com/t5/image/serverpage/image-id/55911iB0FF61700BECE758/image-size/medium?v=v2&px=400)
The analysis actually creates another data table in order to build the GB image on the lower right, this data table:
![SDF1_1-1692723822865.png SDF1_1-1692723822865.png](https://community.jmp.com/t5/image/serverpage/image-id/55912i2C3283F2E62EBD56/image-size/medium?v=v2&px=400)
But, when the analysis is over with, or the user performs an analysis on another column, this data table is deleted and I don't have a reference to it anymore -- I tried using the <<Save Script for All Objects to Data Table command, but this requires a reference to the above data table to then generate the graph builder, but the data table is now gone.
Instead, I'm having to save the window as a png, which is OK, and should look like the first image above, but as a PNG. One iteration of the code in the script where I'm doing this is here:
Button Box( "Save Results to DT",
path = dt << Get Path; //gets the dt's path
l = Length( path ) - Length( dt << GetName ) - 4; // takes off dt name and .jmp extension
dir = Left( path, l ); //actual path where the PNG file is supposed to be saved
If( N Items( Icols ) == 0 & N Items( Xcols ) == 0,
pic_name = "Self_Corr_" || ycols[1] || ".png"; //name of the picture
nwin[Outline Box( 1 )] << Save Picture( dir || pic_name, "png" ); //saves the report window as a PNG to the directory
full_name=dir||pic_name;
dt << New Script( "Self Corr of " || ycols[1], Open( full_name ) ); // the new script is supposed to substitute the actual dir name and pic_name, not the variables.
);
)
It creates a script to the data table that looks like this:
![SDF1_3-1692724985070.png SDF1_3-1692724985070.png](https://community.jmp.com/t5/image/serverpage/image-id/55914i30D015FA755EEBCC/image-size/medium?v=v2&px=400)
But, the script should be this instead:
![SDF1_4-1692725028809.png SDF1_4-1692725028809.png](https://community.jmp.com/t5/image/serverpage/image-id/55915i4C5D02F88B74F574/image-size/medium?v=v2&px=400)
Where I've copy/pasted what should be in the script to show what I'm trying to have the main script do. This should be doable, but all the attempts I've made don't work.
As mentioned previously, I am OK with saving the reports as PNGs and the user just open the report as a PNG in JMP, but if possible, I'd rather have the temporary data tables saved to the New Script() so that when the user clicks on the script, it will generate the needed temporary data table for the full interactive ability, but I suspect that will be harder.
Thanks for any input or suggestions!,
DS