cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
inqmnd
Level I

JSL split function keep column name in header when splitting a single column

Hi all,

I have a section of jsl code which takes my data table and splits a variable amount of columns (code attached below).

 

 

//Variable Table splitting operation
dt_split = new << Split(
Split By( :SamplePos, :File ID ),
Split( Eval List( EmitCols ) ), //Here is the line where I choose a variable amount of columns within the data table to split
Group(:Cycles),
Output Table( "Split_Table" ),
Remaining Columns( keep all ),
Sort by Column Property

 

 

When the columns specified within EmitCols are greater than 1 it returns a data table where the new columns are annotated with the name of each column specified within EmitCols, however when there is only 1 column within EmitCols it omits annotating the new columns with the name. Is there an attribute within the split() function where I can keep the annotations when only splitting out by 1 column? If not, is there a way to over ride this behavior?   

 

Edit: I have tried searching the scripting index and so far I could not find any attribute of split which allows me to do that. 

1 ACCEPTED SOLUTION

Accepted Solutions
Byron_JMP
Staff

Re: JSL split function keep column name in header when splitting a single column

Ok, so I can see what's going on, and I can see why it was developed that way, and also, I can't see a simple way around it.  So here's a brute force method, in the least elegant way possible.

 


dt<<new column("blank");
insert into (EmitCols, :blank)   //or some how get :blank into that split list

//do your split here
dt=current data table();
clist=dt<<get column names();
del={};
for (i=1, i<=nitems(clist), i++,
if(contains(clist[i], "blank")>1,insert into(del, clist[i]));
);
dt << Select Columns( del );
dt << Delete Columns();
JMP Systems Engineer, Health and Life Sciences (Pharma)

View solution in original post

1 REPLY 1
Byron_JMP
Staff

Re: JSL split function keep column name in header when splitting a single column

Ok, so I can see what's going on, and I can see why it was developed that way, and also, I can't see a simple way around it.  So here's a brute force method, in the least elegant way possible.

 


dt<<new column("blank");
insert into (EmitCols, :blank)   //or some how get :blank into that split list

//do your split here
dt=current data table();
clist=dt<<get column names();
del={};
for (i=1, i<=nitems(clist), i++,
if(contains(clist[i], "blank")>1,insert into(del, clist[i]));
);
dt << Select Columns( del );
dt << Delete Columns();
JMP Systems Engineer, Health and Life Sciences (Pharma)