Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
lwx228
Level VII

How do can convert all "&" s in a cell to newline characters using JSL?

Such as

ab>=-14&P1>=174.1&EVk<34341 or Missing&xyz<214.98 or Missing&EVk<154 or Missing&P1>=1741

Convert multiple rows of data:

 

ab>=-14
P1>=174.1
EVk<34341 or Missing
xyz<214.98 or Missing
EVk<154 or Missing
P1>=1741

2020-06-18_20-14.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: How do can convert all "&" s in a cell to newline characters using JSL?

This is an easy one, given the Word() function in JMP.  The script below assumes the line of text is in a JMP data table called "Text", and the column name is "Column 1".  But, with minor modifications, it could work on a text string read into a JMP variable.

Names Default To Here( 1 );

dt = Data Table( "Text" );
dtOut = New Table( "Output", New Column( "T1", character ) );

wordCNT = 1;

While( Word( wordCNT, dt:Column 1[1], "&" ) != "",
	dtOut << add Rows( 1 );
	dtOut:T1[wordCNT] = Word( wordCNT, dt:Column 1[1], "&" );
	wordCNT++;
);
Jim

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

Re: How do can convert all "&" s in a cell to newline characters using JSL?

This is an easy one, given the Word() function in JMP.  The script below assumes the line of text is in a JMP data table called "Text", and the column name is "Column 1".  But, with minor modifications, it could work on a text string read into a JMP variable.

Names Default To Here( 1 );

dt = Data Table( "Text" );
dtOut = New Table( "Output", New Column( "T1", character ) );

wordCNT = 1;

While( Word( wordCNT, dt:Column 1[1], "&" ) != "",
	dtOut << add Rows( 1 );
	dtOut:T1[wordCNT] = Word( wordCNT, dt:Column 1[1], "&" );
	wordCNT++;
);
Jim

View solution in original post

Highlighted
lwx228
Level VII

Re: How do can convert all "&" s in a cell to newline characters using JSL?


Thank Jim!


This allows JSL to complete the text column of the leaf label formula to restore the formula without the need for VBA.
Article Labels