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
nm1
nm1
Level I

Change format to duration with script

I am importing data from an excel spreadsheet. I have one column that exists in this excel as a duration (format=min:s). This is imported automatically as character. I would like to change it to a duration within a script. As suggested in lots of posts (eg here: Changing of column formats not working as I expect <<Format(Duration, :hr:m:s) 

 

I tried the following:

column(dt,"Cycle Time")<<data type(Numeric)<<Modeling Type(Continuous)<<Format( "min:s",12,0);

but this gives me a column of only missing values. (dt is my imported data table, "Cycle Time" is the name of the column). The conversion works when I do it manually, using the Column Info dialog.

I am using Jmp15.1.0 on Windows. Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Change format to duration with script

There is an optional form of the << Data Type message that combines all three steps:

 

Capture.JPG

 

So your code might change to:

 

Column( dt, "Cycle Time" ) << Data Type( "Numeric", Format( "min:s" ) ) << Modeling Type( "Continuous" );

See if that form works better.

Learn it once, use it forever!

View solution in original post

2 REPLIES 2
Highlighted

Re: Change format to duration with script

There is an optional form of the << Data Type message that combines all three steps:

 

Capture.JPG

 

So your code might change to:

 

Column( dt, "Cycle Time" ) << Data Type( "Numeric", Format( "min:s" ) ) << Modeling Type( "Continuous" );

See if that form works better.

Learn it once, use it forever!

View solution in original post

Highlighted
nm1
nm1
Level I

Re: Change format to duration with script

Yep, that did the trick - thanks for the quick response!