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
mdawson69
Level IV

Creating data tables without copying over embedded scripts

When a new data table is created from an existing data table—such as the result of creating summaries or generating subsets—JMP automatically attaches any scripts that are “properties” of the original data table into the new data table. For much of my work this is a major nuisance, as those scripts are often not of much use in the new data table. In some of my more extensive work, this means I have to manually delete numerous scripts from data tables that I generate to avoid confusion later.


Is there a preference setting that prevents JMP from copying over data table scripts to data tables that are generated from a data table that has scripts embedded? Also, if I write a script that generates new data tables, what would I use to prevent the table property scripts from appearing in the new data table? In the case of the latter, I know there is Delete Table Property, but that would require code to delete each embedded script; I would like for them to not appear in the first place.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Creating data tables without copying over embedded scripts

I am not aware of a preference that can be set to stop the copying of scripts when you manually use the subset platform.  However, here is a script that can be used as a model on how to script such a subset;

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt2 = dt << subset( selected columns( 0 ), selected rows(0) );

names = dt2 << Get Table Script Names;

For( i = 1, i <= N Items( names ), i++,

       dt << Delete Table Property( names[i] )

);

Jim

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: Creating data tables without copying over embedded scripts

I am not aware of a preference that can be set to stop the copying of scripts when you manually use the subset platform.  However, here is a script that can be used as a model on how to script such a subset;

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt2 = dt << subset( selected columns( 0 ), selected rows(0) );

names = dt2 << Get Table Script Names;

For( i = 1, i <= N Items( names ), i++,

       dt << Delete Table Property( names[i] )

);

Jim
mdawson69
Level IV

Re: Creating data tables without copying over embedded scripts

Thanks. That is definitely a solution for when I am scripting. Unfortunately, that still leaves the problem for non-routine analysis/data manipulation where scripting is not involved; which for me is much of the time. If there is no preference to turn this off, then perhaps I will contact support and suggest it.

I cannot fathom why SAS would have that type of feature turned on by default let alone have it as something that can be disabled. Obviously I cannot speak to other workflows, but as I mentioned in my original posts, once I create a new data table from a source data table, the scripts in the source data table are generally non-applicable for any number of reasons.

txnelson
Super User

Re: Creating data tables without copying over embedded scripts

It is easy for me to justify why passing the scripts on to a new table would be the default choice.  It literally does no harm to do so, where, if the default was to strip the scripts out, would potentially cause a good amount of problems, if one wants the scripts passed on. 

I do agree that having a preference, or an option in the various pulldown menu "Tables" platforms would be a nice feature, and I encourage you to pass on your request to:

    support@jmp.com

BTW, the script I passed on to you, could easily be put into a new toolbar tool, and then all you would have to do is invoke that for any data table you interactively produce

Jim
mdawson69
Level IV

Re: Creating data tables without copying over embedded scripts

Thanks. How do I put a script into a new toolbar tool?

txnelson
Super User

Re: Creating data tables without copying over embedded scripts

The brief overview of how to set this up is formally documented starting on page 443 of the users guide available in JMP

    Help==>Books==>Using JMP

Here is what I suggest how you do what you want:

Go to the pull down menus

   View==>Customize==>Menus and Toolbars

In the window displayed click on the gray triangle in the Toolbars section, that is just to the left of Tools

Once the Tools section is expanded, right click on the last tool, and specify to "Insert After"

Select "Command" and click on OK

In the "Internal Name" input, type in "removescripts"

In the "Caption" input, type in "Remove Scripts"

In the "Run this JSL" input area, Paste in the following script:

Names Default To Here( 1 );

dt = Current Data Table();

names = dt << Get Table Script Names;

For( i = 1, i <= N Items( names ), i++,

       dt << Delete Table Property( names[i] )

);

Now go down to the "New shortcut (press shortcut keys): and click on the input area

This is where you will assign a key stroke to use to invoke your little script, I suggest CNTL/r

The short cut must be a CNTL+ something key stroke

So now just press CNTL/r

It will now appear in the input area

Now just click on OK, and you have a new shortcut to use

To try it out, just open a data table with some scripts, click on the data table and then press CNTL/r

Jim
mdawson69
Level IV

Re: Creating data tables without copying over embedded scripts

Awesome!

I had to add a condition so that the Source script is not removed, but it otherwise worked great. Thanks again.