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

Copy-Paste error with JSL [Column "???" requires numeric vlaues]

I don't  know why this isn't working. I select rows who are empty, select a seccond column and try to copy them into the empty ones.

Both columns are numeric and it worked sometimes with other tables.

 

Sample table ans script is attached.

 

dt_2= data table("Untitled 20");
dt_2 << Select Where(Is Missing( :target1));
rs = dt_2 << Get Selected Rows();
if(nitems(rs)>0,
	dt_2:target1[rs] = dt_2:temp1[rs];
	dt_2:target2[rs] = dt_2:temp2[rs];
	//dt_2 << Delete Columns( :temp , :temp2 );
);

Alert:

Error message.png

 

THX

       Mauro

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS
2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Copy-Paste error with JSL [Column "???" requires numeric vlaues]

  1. In your provided data table, your "temp" columns are "temp" and "temp2", not "temp1" and "temp2"
  2. You need to loop through the assignments.  A JMP data table can not handle assignments where the right hand argument has multiple values.  See my changes below 
    Names Default To Here( 1 );
    dt_2 = Data Table( "Untitled 20" );
    // dt_2 << Select Where( Is Missing( :target1 ) );
    // rs = dt_2 << Get Selected Rows();
    // Simplier code
    rs = dt_2 << Get Rows Where( Is Missing( :target1 ) );
    If( N Items( rs ) > 0,
    	For( i = 1, i <= N Items( rs ), i++,
    		dt_2:target1[rs[i]] = dt_2:temp[rs[i]];
    		dt_2:target2[rs[i]] = dt_2:temp2[rs[i]];
    	//dt_2 << Delete Columns( :temp , :temp2 );
    	)
    );
Jim

View solution in original post

Mauro_Gerber
Level IV

Re: Copy-Paste error with JSL [Column "???" requires numeric vlaues]

THX @txnelson 

This works, but I try to avoid for-loops.

It works with an array, but not with the table itself:

 

temp = dt_2:tartet2 << get values();  // copy row from target
temp[rs] = dt_2:temp2[rs]; // replace the values in the array
dt_2:target2 << set values(temp); // re-insert into target
"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Copy-Paste error with JSL [Column "???" requires numeric vlaues]

  1. In your provided data table, your "temp" columns are "temp" and "temp2", not "temp1" and "temp2"
  2. You need to loop through the assignments.  A JMP data table can not handle assignments where the right hand argument has multiple values.  See my changes below 
    Names Default To Here( 1 );
    dt_2 = Data Table( "Untitled 20" );
    // dt_2 << Select Where( Is Missing( :target1 ) );
    // rs = dt_2 << Get Selected Rows();
    // Simplier code
    rs = dt_2 << Get Rows Where( Is Missing( :target1 ) );
    If( N Items( rs ) > 0,
    	For( i = 1, i <= N Items( rs ), i++,
    		dt_2:target1[rs[i]] = dt_2:temp[rs[i]];
    		dt_2:target2[rs[i]] = dt_2:temp2[rs[i]];
    	//dt_2 << Delete Columns( :temp , :temp2 );
    	)
    );
Jim
Mauro_Gerber
Level IV

Re: Copy-Paste error with JSL [Column "???" requires numeric vlaues]

THX @txnelson 

This works, but I try to avoid for-loops.

It works with an array, but not with the table itself:

 

temp = dt_2:tartet2 << get values();  // copy row from target
temp[rs] = dt_2:temp2[rs]; // replace the values in the array
dt_2:target2 << set values(temp); // re-insert into target
"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS