I want to store a small table in another table so that a script that uses both in the same report can reconstruct the small one whenever it's called for. This seems a nice solution because then users of the table can also easily open that small, related table of info while only storing one datatable.
I did get the following to work, after much gnashing of teeth over layers of expr() syntax....
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 = Open("$SAMPLE_DATA/Abrasion.jmp");
ts=dt<< Get Script();
Close(dt,nosave);
ne=nameexpr(ts);
eval(substitute(expr(dt2<<newscript("BigClass",n)),expr(n),nameexpr(ne)));
//...later...
dt2<<runscript("BigClass");
dtBigClass=currentdatatable();
But, 2 questions...
1) is it really this complicated? Having used getscript() to get the script is there no simpler way to "put" the script I got into a table?
2) I'm not thrilled about using currentdatatable() to have the variable dtBigClass point at the table after running the script. Seems prone to maybe getting the wrong thing in there. Say the script fails or there's some timing issue, it's still doing to assign some table or other to dtBigClass. The script looks like "New Table("Big Class.. blah, blah" and I'd really like to run " dtBigClass=NewTable("Big Class...blah blah..." I'd be very happy with a solution where I can "get" the script into the form of a text string that I can edit and run more straightforwardly.