Subscribe Bookmark RSS Feed
julian

Staff

Joined:

Jun 25, 2014

Copy Script For Selected Column(s) to Clipboard

This Add-in will copy the script of the selected column(s) to the system clipboard. When pasted into a script window and run, the copied script will recreate the original column(s), including all properties (formula, value ordering, etc). This can be useful to move formula columns from one table to another (assuming the necessary columns are available for the formula to operate on).

 

Comments

Nice add-in, @julian.

 

Can you contrast it with the script you get if you right click on a column header and choose Copy Column Properties?

 

JMPScreenSnapz070.png

 

julian

Great question, Jeff!  Both are similar and it's worth distinguishing their uses.

 

"Copy Column Properties" is useful when you have a new column (or set of columns in the case of "Copy Multi Columns Properties") to which you want to apply the properties available in your source columns (note that format, modeling type, and data types are not included).

 

Take the example of a column that is standardizing the heights in "Big Class." When you Copy Column Properties, the script in the system clipboard will look like this 

 

Add Column Properties( Formula( Col Standardize( :height ) ) )

 

An important feature of this method is that the function "Add Column Properties()" encapsulates the available properties of that column, which means when you right click a new column and "Paste Column Properties" those customizations will be applied.

 

The Add-in here does something subtly different. When copying the script from the same column using the Add-in, the following JSL is placed in the clipboard:

 

New Column("Standardize[height]", Numeric, "Continuous", Format("Best", 12), Formula(Col Standardize(:height)), Set Selected);

This code includes the JSL for creating a new column of the same name, data type, modeling type, formatting, and all available properties.  When run, this creates the identical column, which is useful when porting a large number of formula columns to a new table, especially when there is extensive customization, or for creating a repository of often used columns that one will apply to future tables. 

 

I hope this helps distinguish these two operations!

M_Anderson

@julian - I love this add-in!  I wanted to emphasize something that you mentioned but didn't really stress about what you've done.  Your add-in gets the column properties, yes, but also gets the data type, modeling type, formatting, etc... which are not captured by the "Copy Column Properties".  That in and of itself is incredibly useful.

 

Best,

 

M

Article Labels
Article Tags
Contributors