cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
shankyjain
Level I

In JSL having trouble adding a new column to a newly transposed datatable

Here is the complete log


Log output:

 

 

Column not found in access or evaluation of 'Bad Argument'
 
Send Expects Scriptable Object in access or evaluation of 'Send' , dt_3 << New Column( "Dev", Character, Nominal, "Source" )
 
In the following script, error marked by /*###*/
dt_1 = Current Data Table();
cc = dt_1 << Get Column Names;
cc[3] << Set Selected( 1 );
For( i = 36, i <= 58, i++,
  cc << Set Selected( 1 )
);
dt_2 = dt_1 << Subset( Selected, Output Table Name( "I_tmp" ) );
cc = dt_2 << Get Column Names;
ncols = N Items( cc );
For( i = 2, i <= ncols, i++,
  cc << Set Selected( 1 )
);
dt_3 = dt_2 << Transpose(
  columns( Selected ),
  By( :Column 1 ),
  Output Table Name( "I" )
);
dt_3 << /*###*/New Column( "Dev", Character, Nominal, "Source" ) /*###*/;
{}

 

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: In JSL having trouble adding a new column to a newly transposed datatable

:Column 1 refers to Column("Column 1") whereas Column(1) refers to the first column. Column(dt_3, 1) refers to the first column in data table dt_3.

View solution in original post

4 REPLIES 4
shankyjain
Level I

Re: In JSL having trouble adding a new column to a newly transposed datatable

Found Partial Answer: Had to change columns(Selected) to (Selected) in

dt_3 = dt_2 << Transpose(
columns( Selected ),
By( :Column 1 ),
Output Table Name( "I" )
);

But, my way referring to first column as :Column 1 in By() is not working. Is there as way to refer to columns by say first, second rather than their actual names?

ms
Super User (Alumni) ms
Super User (Alumni)

Re: In JSL having trouble adding a new column to a newly transposed datatable

:Column 1 refers to Column("Column 1") whereas Column(1) refers to the first column. Column(dt_3, 1) refers to the first column in data table dt_3.

shankyjain
Level I

Re: In JSL having trouble adding a new column to a newly transposed datatable

Column(1) refers to first column in table you mean, then i can give Transpose(columns(1,5,8), By(column(4))..... right?

ms
Super User (Alumni) ms
Super User (Alumni)

Re: In JSL having trouble adding a new column to a newly transposed datatable

Yes, that should work.

(Sorry, I've edited my confusing typos in previous post)