cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
0 Kudos

Simple way to copy and paste columns

What inspired this wish list request? 

There are many instances when I need to combine columns from different data tables into a new table. I know there are workarounds to do this (subsets, get script, etc), but why can't there be a simple copy column/paste column command?

 

What is the improvement you would like to see? 

Add copy/paste column commands to JSL

 

Why is this idea important? 

Makes a common task very simple instead of resorting to more complex JSL workarounds.

 

6 Comments
hogi
Level XII

you mean:
 << copy column as a synonym for << get script?

If  copy column(col), is also fine,  you could create a wrapper for << get script:

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 = Open( "$SAMPLE_DATA/Big Class Families.jmp" );

dt << New Formula Column(
	Operation( Category( "Combine" ), "Ratio" ),
	Columns( :height, :weight )
);

copy column = Function({col},
	script = col << get script
);

paste column = Function({},
	script
);

copy column (Name Expr(Column("height/weight")));
Current data table(dt2);
paste column();

And via the GUI,  copy column / paste column is available:

hogi_0-1722272561377.png

scott1588
Level IV

I'm looking for something that is as simple as the copy/paste column items in the GUI but for JSL.

 

Just dt << copy column (:name)

and

dt2 << paste column

no expr or any other JSL involved.

 

Maybe with a couple of position modifiers such as <after :colname>, <end>, etc.

scott1588
Level IV

Interestingly... there is a Copy Column command listed in the scripting index. But it has no information about it. I can't find it in the scripting guide.

 

But there is no Paste Column.

scott1588
Level IV

Another interesting variation of this might be to add modifiers to the New Table command to list columns to pull from other tables

 

New Table (dt1:colname, dt1:colname2, dt2:colname3)

 

This would create a New Table with the columns pulled from dt1 and dt2

Status changed to: Acknowledged
 
hogi
Level XII

For the 'new table' you could select the 3 columns, generate a (non linked) subset and delete all rows.