cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
DKI
DKI
Level II

digits to appear as double digits

Hi

 

The JSL script below is outputting a week number from a data in JSL. however it outputs the lower weeks as 1-9 in single digits however, I need these to appear in double digits ie 01 instead of 1, 02 instead of 2..etc.

 

I am hoping someone knows a way to do this, any ideas would be great.

 

JSL script

ST << New Column( "ww",

Numeric,

"Nominal",

Format( "Best", 12 ),

Formula( Week Of Year( :time ) )

);

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: digits to appear as double digits

If you are using JMP 13, in your script, set the format to:

Format(
	"Custom",
	Formula( Substr( "00", 1, 2 - Length( Char( value ) ) ) || Char( value ) ),
	12
)

 

Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: digits to appear as double digits

If you are using JMP 13, in your script, set the format to:

Format(
	"Custom",
	Formula( Substr( "00", 1, 2 - Length( Char( value ) ) ) || Char( value ) ),
	12
)

 

Jim
DKI
DKI
Level II

Re: digits to appear as double digits

Thanks alot Jim.

Spent ages trying to find something that could do that in the column info.

Not exactly sure how substring command is doing that but it works.

txnelson
Super User

Re: digits to appear as double digits

To learn about the Substr function and as a matter of fact, any of the functions, go to the Scripting Index.  For info on the Substring(Substr) function:

 

     Help==>Scripting Index==>Functions==>Character==>Substr

Jim