cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
rijking
Level II

pp[k]<

@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

5 REPLIES 5
Craige_Hales
Super User

Re: pp[k]<

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
rijking
Level II

Re: pp[k]<

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;
txnelson
Super User

Re: pp[k]<

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
Level II

Re: pp[k]<

Perfect - many thanks!

Craige_Hales
Super User

Re: pp[k]<

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