- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Copying scripts from one data table to another
I would like to be able to take scripts stored in one table (A) and use them in another table (B). How can I do this? I'll need to be able to code this in JSL.
Alternatively, how could I add a script that's stored on my computer (a JSL file) to a data table?
This is similar to another user's question that was answered about adding a script from a graph to a table. Unfortunately, I don't think I can use the Get Script command in my situation because I don't want the script that made the table, I want a script stored in the table.
Thank you!
Katie
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Copying scripts from one data table to another
@David_Burnham 's script for getting all scripts from a data table seemed to be missing a [i] on line 9:
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt2 = new table("little class");
lstScriptNames = dt << Get Table Script Names();
For (i=1,i<=NItems(lstScriptNames),i++,
scriptName = lstScriptNames[i];
scriptDef = dt << get table variable(scriptName);
Eval(Parse(Eval Insert( "\[
dt2 << New Script( "^scriptName^", ^scriptDef^ )
]\")));
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Copying scripts from one data table to another
If you want to copy a specific script you can use the following code:
dt = Open("$SAMPLE_DATA/Big Class.jmp");
scriptName = "Oneway";
scriptDef = dt << get table variable(scriptName);
dt2 = new table("little class");
Eval(Parse(Eval Insert( "\[
dt2 << New Script( "^scriptName^", ^scriptDef^ )
]\")));
If you want to copy all of the scripts then you can do this:
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt2 = new table("little class");
lstScriptNames = dt << Get Table Script Names;
For (i=1,i<=NItems(lstScriptNames),i++,
scriptName = lstScriptNames;
scriptDef = dt << get table variable(scriptName);
Eval(Parse(Eval Insert( "\[
dt2 << New Script( "^scriptName^", ^scriptDef^ )
]\")));
)
-Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Copying scripts from one data table to another
Thank you very much! This worked.
I think a nice feature to add to JMP would be to allow scripts to be added to JMP tables as files or references- eliminate the need for the eval statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Copying scripts from one data table to another
@David_Burnham 's script for getting all scripts from a data table seemed to be missing a [i] on line 9:
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt2 = new table("little class");
lstScriptNames = dt << Get Table Script Names();
For (i=1,i<=NItems(lstScriptNames),i++,
scriptName = lstScriptNames[i];
scriptDef = dt << get table variable(scriptName);
Eval(Parse(Eval Insert( "\[
dt2 << New Script( "^scriptName^", ^scriptDef^ )
]\")));
)