BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
rijking
Community Trekker

pp[k]<<Set Selected results in error Send Expects Scriptable Object{1}

@Craige_Hales I have a similar problem having recently upgraded from JMP 10 to JMP 13. The 

following is deployed multiple times in a script to compress selected columns.

pp=dt<<Get Column Names(); ncols = N Items(pp); for(k=1,k<=ncols,k++, pp[k]<<Set Selected(1););
dt << Compress Selected Columns();

This works fine in JMP 10 but with JMP 13 and I am getting the following error:

Send Expects Scriptable Object{1} in access or evaluation of 'Send' , pp[k] <<  /*###*/Set Selected( 1 ) /*###*/

 I can see from the above I need to separate this into two steps, but can't quite work out the syntax - are you able to help please? Many thanks

0 Kudos
5 REPLIES 5

Re: pp[k]<<Set Selected results in error Send Expects Scriptable Object{1}

Your script looks OK in JMP 10,11,12,13, I think something else has changed. Maybe add show(pp); and check the log to see what's going on.  pp[k] is a column (all 5 times) when I run it with Big Class.jmp for the dt.

Craige
0 Kudos
rijking
Community Trekker

Re: pp[k]<<Set Selected results in error Send Expects Scriptable Object{1}

Having added show(pp); the log does indeed show the column names are returned, but the columns are still not being selected - please see the full log below. Any ideas? Many thanks.

 

//:*/
dt=current data table();

pp=dt<<Get Column Names(); 
show (pp);
ncols = N Items(pp); for(k=1, k<=ncols, k++, pp[k] << Set Selected(1));
dt << Compress Selected Columns();
dt << Clear Column Selection;
/*:

pp = {id, yr, rgC, rtC, ptC, cmdC, qtC, TdeQ, NetW, TdeV};
Send Expects Scriptable Object{1} in access or evaluation of 'Send' , pp[k] <<  /*###*/Set Selected( 1 ) /*###*/

In the following script, error marked by /*###*/
dt = Current Data Table();
pp = dt << Get Column Names();
Show( pp );
ncols = N Items( pp );
For( k = 1, k <= ncols, k++,
	pp[k] <<  /*###*/Set Selected( 1 ) /*###*/
);
dt << Compress Selected Columns();
dt << Clear Column Selection;
0 Kudos
Highlighted
txnelson
Super User

Re: pp[k]<<Set Selected results in error Send Expects Scriptable Object{1}

If you add an As Column() to the column reference it should work

Names Default To Here( 1 );
dt = Current Data Table();

pp = dt << Get Column Names();
Show( pp );
ncols = N Items( pp );
For( k = 1, k <= ncols, k++,
	As Column( pp[k] ) << Set Selected( 1 )
);
dt << Compress Selected Columns();
dt << Clear Column Selection;
Jim
rijking
Community Trekker

Re: pp[k]<<Set Selected results in error Send Expects Scriptable Object{1}

Perfect - many thanks!

0 Kudos

Re: pp[k]<<Set Selected results in error Send Expects Scriptable Object{1}

Jim has the answer. Here's why:

height=7;
dt=open("$sample_data/big class.jmp");
pp=dt<<getcolumnnames();
ncols=nitems(pp);
for(k=1,k<=ncols,k++,/*ascolumn*/(pp[k])<<setselected(1));

there is a variable in the JMP global namespace with the same name as one of the table's columns. Using ascolumn tells JMP to resolve the name with the current data table. You can also specify the data table in ascolumn( dt, pp[k] ) (highly recommended if you might have more than one table open!)

Craige