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:

THX
Mauro
ScriptingRe: Copy-Paste error with JSL [Column "???" requires numeric vlaues]- In your provided data table, your "temp" columns are "temp" and "temp2", not "temp1" and "temp2"
- 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 );
)
);
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