cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
jan_solo
Level III

Delete a script from a datatable

Hi everyone,

 

I'm currently writing a script that pulls data from a DB.  I add several scripts to the datatable (not in a column, but in the script box, frame top left of the datatable).

JMP adds standard some of the scripts.  One of them is 'Save To DB'.  This script needs to get deleted in the script I'm writing.

 

I can't have the users run this script accidently.  In the past we did 1 DB-update and it completely destroyed the structure of our DB (meaning other programs that connect to th DB stopped working).  Therefore leaving it in is actually a big production risk (and it will happen frequently).

 

I can add scripts with

dt << New Script( ... );

however,

dt << Delete Script( 'MyScript' );

doesn't work.

 

Can anyone help me with this please?

Thanks!!!

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Delete a script from a datatable

Unfortunately these objects were originally known as table properties and now we call them table scripts. The message protocol to the data table is a bit confusing as a result.

See Help > Scripting Index > Objects > Data Table. Select Delete Table Property in the second list for more information. This message is the one that you are looking for.

View solution in original post

pmroz
Super User

Re: Delete a script from a datatable

Here's some code that deletes two table variables and one property:

current_dataset << Delete Table Variable("JSL");
current_dataset << Delete Table Variable("SQL");
current_dataset << Delete Table Property("Source");

In addition you can hide the ODBC connection string with a preference.  In JSL you can do this:

pref(ODBC Hide Connection String(1));

View solution in original post

3 REPLIES 3

Re: Delete a script from a datatable

Unfortunately these objects were originally known as table properties and now we call them table scripts. The message protocol to the data table is a bit confusing as a result.

See Help > Scripting Index > Objects > Data Table. Select Delete Table Property in the second list for more information. This message is the one that you are looking for.

pmroz
Super User

Re: Delete a script from a datatable

Here's some code that deletes two table variables and one property:

current_dataset << Delete Table Variable("JSL");
current_dataset << Delete Table Variable("SQL");
current_dataset << Delete Table Property("Source");

In addition you can hide the ODBC connection string with a preference.  In JSL you can do this:

pref(ODBC Hide Connection String(1));
KalaiAce21
Level I

Re: Delete a script from a datatable

 

I know this is late... but just for reference. 

 

//To get all the names of the scripts in a data table
lstScripts = dt << Get Table Script Names;

//delete scripts in data table
dt << Delete Scripts(lstScripts);  // delete all scripts
dt << Delete Scripts({"Script1", "Script2"});   // delete certain scripts only