cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
lala
Level VIII

怎样用脚本实现粘贴?

我按下面的脚本将第一列的带列名复制。
如何用脚本将复制内容到其他表中带列名粘贴?

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Clear Select();
dt << Select Columns( 1 );
Current Data Table() << Bring Window To Front;
Main Menu( "Copy With Column Names" );
dt << Select Where( Row() == 1 );
d3 = dt << Subset( Selected Rows( 1 ), selected columns( 0 ) );
Current Data Table( d3 );
d3 << Select Columns( 1 );
Current Data Table() << Bring Window To Front;
Main Menu( "Paste With Column Names" );

2021-11-25_17-09-04.png

 

简单的问题、我却不能实现。谢谢!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: 怎样用脚本实现粘贴?

Extracting the script from a column, creates a script that will recreate a new column.  If you want to move values from one data table into a column in another table, where the column already exists, you might want to use something like the code below

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
theValues = column(dt, 1) << get values;

dt << Select Where( Row() == 1 );
d3 = dt << Subset( Selected Rows( 1 ), selected columns( 0 ) );
d3 << add rows(nitems(theValues)-1);
column(d3,1) << set values(theValues);
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: 怎样用脚本实现粘贴?

Apparently, the 

Main Menu( "Paste With Column Names" );

is not implemented.  However, the following code will perform the same function

names default to here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
theScript = column(dt,1) << get script;
d3 = new table("new");
theScript;
Jim
lala
Level VIII

Re: 怎样用脚本实现粘贴?

感谢专家!

 

我试着这样修改代码、但它是创建新列来粘贴。

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
theScript = column(dt,1) << get script;

dt << Select Where( Row() == 1 );
d3 = dt << Subset( Selected Rows( 1 ), selected columns( 0 ) );
Current Data Table( d3 );
d3 << Select Columns( 1 );

theScript;

2021-11-25_18-11-40.png

lala
Level VIII

Re: 怎样用脚本实现粘贴?

最新版的脚本录制虽然有改进、但还是很多操作是不能录制为脚本的。

 

 

txnelson
Super User

Re: 怎样用脚本实现粘贴?

Extracting the script from a column, creates a script that will recreate a new column.  If you want to move values from one data table into a column in another table, where the column already exists, you might want to use something like the code below

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
theValues = column(dt, 1) << get values;

dt << Select Where( Row() == 1 );
d3 = dt << Subset( Selected Rows( 1 ), selected columns( 0 ) );
d3 << add rows(nitems(theValues)-1);
column(d3,1) << set values(theValues);
Jim