cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to move from signal modeling to system modeling at the first JMP Aerospace Analytics webinar. Register. June 18, 1 p.m. US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
LipYeong
Level II

How to delimit multiple column with specific string in jsl

Hi,

 

I've a table that would like to delimit multiple column with specific string

Script below able to point to the specific column but unable to delimit the data

Appreciate if anyone could help on this. Thanks

 

 

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


headerList = dt << get column names( string );

For( i = 1, i <= N Items( headerList ), i++,

	If(  Contains(headerList[i], "sales"), 
		Column( dt, headerList[i] ) << text to columns( delimiter( "_" ));
	);
		
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
pauldeen
Level VI

Re: How to delimit multiple column with specific string in jsl

You have to send that command to the table not the column. When you do, it inserts extra columns to the right so going left to right is going to break things. You need to go right to left (i-- instead of i++) This works:

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


headerList = dt << get column names( string );

For( i = N Items( headerList ), i>=1, i--,
	Data Table( "Sales" ) << Text to Columns(
		columns( Column(dt, i) ),
		Delimiters( "_" )
	);
		
);

View solution in original post

2 REPLIES 2
pauldeen
Level VI

Re: How to delimit multiple column with specific string in jsl

You have to send that command to the table not the column. When you do, it inserts extra columns to the right so going left to right is going to break things. You need to go right to left (i-- instead of i++) This works:

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


headerList = dt << get column names( string );

For( i = N Items( headerList ), i>=1, i--,
	Data Table( "Sales" ) << Text to Columns(
		columns( Column(dt, i) ),
		Delimiters( "_" )
	);
		
);
LipYeong
Level II

Re: How to delimit multiple column with specific string in jsl

Thanks Paul, this solution works. I've added the for loop into the if condition statement and it solved the issues. 

 

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

headerList = dt << get column names( string );

For( i = N Items( headerList ), i>=1, i--,
	If(  Contains(headerList[i], "CLASSHOT 1"), 
	dt << Text to Columns(columns( Column(dt, i) ),Delimiters( "_" ));
		
);
);

Recommended Articles