saving script to data table issueHI all,
I have written a script (a few hundred lines) that 1) opens an existing data table, 2) does a whole bunch of calculations and then 3) spits out a new data table with results from these calculations. Because I am continually improving the script, I want to make sure that I know which exact version of the script was used to create the new output data table and so thought of saving the whole script to the data table. I tried using NewDt<
Regards and thanks, Yves
Data TableScriptingRe: saving script to data table issueHere is a simple script that will show you one way to do this
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
biv = dt << bivariate( x( :height ), y( :weight ) );
theScript = Char( biv << get script );
Eval( Parse( "\[dt<<NEW script=""></NEW>
Re: saving script to data table issueSo the question is, where does the script elements come from that you need to put together to build the literal string I called, "theScript". So where does what you call the "full script" come from?Re: saving script to data table issueHere is a simple example of what you will have to do to create such a script. Components that you will not be able to get from JMP, you will have to add into theScript as you build it. Basically, you just concatenate it as you go. Then when done, you add it to the data table.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt = current data table();
theScript = "\[dt = current data table(); ]\";
If( try( dt:ratio << get name,"") == "",
dt<<NEW column=""></NEW>
I have also used a method where I first build the entire script as a literal string, and then save it as a script. Then I turn around and run the saved script, which then gives the results.
theScript = "\[
dt = current data table();
dt << bivariate( x(:weight), y(:height));
]\";
Eval( Parse( "\[dt<<NEW script=""></NEW>