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
%3CLINGO-SUB%20id%3D%22lingo-sub-343733%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8jsl%E8%85%B3%E6%9C%AC%E5%B0%87%E6%99%82%E9%96%93%E6%88%B3%E6%95%B8%E6%93%9A%E8%BD%89%E6%8F%9B%E7%82%BA%E6%AF%8F%E5%80%8B%E6%89%B9%E6%AC%A1%E7%9A%84%E6%8C%81%E7%BA%8C%E6%99%82%E9%96%93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-343733%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%A4%A7%E5%AE%B6%E5%A5%BD%EF%BC%8C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%88%91%E5%B7%B2%E7%B6%93%E9%96%8B%E5%A7%8B%E4%BD%BF%E7%94%A8%20JSL%EF%BC%8C%E7%9B%AE%E5%89%8D%E8%99%95%E6%96%BC%E5%88%9D%E5%AD%B8%E8%80%85%E6%B0%B4%E5%B9%B3%E3%80%82%3C%2FP%3E%0A%3CP%3E%E6%88%91%E7%9A%84%E6%95%B8%E6%93%9A%E7%94%B1%E4%B8%8D%E5%90%8C%E9%81%8E%E7%A8%8B%E8%AE%8A%E9%87%8F%E7%9A%84%E6%99%82%E9%96%93%E5%BA%8F%E5%88%97%E6%89%B9%E8%99%95%E7%90%86%E6%95%B8%E6%93%9A%E7%B5%84%E6%88%90%E3%80%82%20%E6%AF%8F%E5%80%8B%E6%89%B9%E6%AC%A1%E9%83%BD%E6%9C%89%E4%B8%8D%E5%90%8C%E7%9A%84%E6%99%82%E9%96%93%E5%BA%8F%E5%88%97%E7%AF%84%E5%9C%8D%2F%E8%99%95%E7%90%86%E6%99%82%E9%96%93%E3%80%82%20%E6%95%B8%E6%93%9A%E5%88%86%E8%BE%A8%E7%8E%87%E7%82%BA%201%20%E5%B0%8F%E6%99%82%E3%80%82%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MK1985_0-1608641051958.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MK1985_0-1608641051958.png%22%20style%3D%22width%3A%20386px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MK1985_0-1608641051958.png%22%20style%3D%22width%3A%20386px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F29067iB9CB504FC0439D52%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22MK1985_0-1608641051958.png%22%20alt%3D%22MK1985_0-1608641051958.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E9%A6%96%E5%85%88%EF%BC%8C%E6%88%91%E6%83%B3%E5%B0%87%E6%89%B9%E8%99%95%E7%90%86%E9%96%8B%E5%A7%8B%E6%99%82%E9%96%93%EF%BC%88%E5%AF%A6%E6%99%82%EF%BC%89%E8%BD%89%E6%8F%9B%E7%82%BA%E5%BE%9E%E6%99%82%E9%96%93%E9%BB%9E%E9%9B%B6%EF%BC%880%EF%BC%89%E9%96%8B%E5%A7%8B%E7%9A%84%E6%8C%81%E7%BA%8C%E6%99%82%E9%96%93%EF%BC%8C%E7%84%B6%E5%BE%8C%E7%B4%AF%E7%A9%8D%E5%88%B0%E5%AF%A6%E6%99%82%E7%B5%90%E6%9D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E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E8%85%B3%E6%9C%AC%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here%20(1)%3B%0Adt%20%3D%20current%20data%20table%20()%3B%0Adt%20%26lt%3B%26lt%3B%20New%20Column(%20%22Duration%22%2C%0ANumeric%2C%0A%22Continuous%22%2C%0AFormat(%20%22Best%22%2C%2012%20)%2C%0AFormula(%0AIf(%20Row()%20%3D%3D%201%2C%200%2C%20%3ATimeStamp%20-%20%3ATimeStamp%5B1%5D%20)%20%2F%2060%0A%0A%0A)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-343733%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E8%85%B3%E6%9C%AC%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-344002%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20jsl%20%E8%85%B3%E6%9C%AC%E5%B0%87%E6%99%82%E9%96%93%E6%88%B3%E6%95%B8%E6%93%9A%E8%BD%89%E6%8F%9B%E7%82%BA%E6%AF%8F%E5%80%8B%E6%89%B9%E6%AC%A1%E7%9A%84%E6%8C%81%E7%BA%8C%E6%99%82%E9%96%93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-344002%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E9%9D%9E%E5%B8%B8%E6%84%9F%E8%AC%9D%E9%A6%AC%E5%85%8B%E3%80%82%20%E5%AE%83%E5%B7%A5%E4%BD%9C%E5%BE%97%E5%BE%88%E5%A5%BD%E3%80%82%20%E8%81%96%E8%AA%95%E7%AF%80%E5%BF%AB%E6%A8%82%20%EF%BC%9A%EF%BC%89%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-343850%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20jsl%20%E8%85%B3%E6%9C%AC%E5%B0%87%E6%99%82%E9%96%93%E6%88%B3%E6%95%B8%E6%93%9A%E8%BD%89%E6%8F%9B%E7%82%BA%E6%AF%8F%E5%80%8B%E6%89%B9%E6%AC%A1%E7%9A%84%E6%8C%81%E7%BA%8C%E6%99%82%E9%96%93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-343850%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%AD%A4%E5%82%99%E9%81%B8%E6%96%B9%E6%A1%88%E4%BD%BF%E7%94%A8%E5%85%A7%E7%BD%AE%E5%87%BD%E6%95%B8%20Col%20Minimum(%20x%2C%20group%20)%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screen%20Shot%202020-12-22%20at%2012.33.16%20PM.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screen%20Shot%202020-12-22%20at%2012.33.16%20PM.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screen%20Shot%202020-12-22%20at%2012.33.16%20PM.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F29072i2F7DF492EF3F1C04%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screen%20Shot%202020-12-22%20at%2012.33.16%20PM.png%22%20alt%3D%22Screen%20Shot%202020-12-22%20at%2012.33.16%20PM.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-343753%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20jsl%20%E8%85%B3%E6%9C%AC%E5%B0%87%E6%99%82%E9%96%93%E6%88%B3%E6%95%B8%E6%93%9A%E8%BD%89%E6%8F%9B%E7%82%BA%E6%AF%8F%E5%80%8B%E6%89%B9%E6%AC%A1%E7%9A%84%E6%8C%81%E7%BA%8C%E6%99%82%E9%96%93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-343753%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E9%80%99%E6%98%AF%E4%B8%80%E5%80%8B%E7%B0%A1%E5%96%AE%E7%9A%84%E8%85%B3%E6%9C%AC%EF%BC%8C%E5%AE%83%E5%89%B5%E5%BB%BA%E4%B8%80%E5%80%8B%E6%96%B0%E5%88%97%EF%BC%8C%E5%85%B6%E4%B8%AD%E5%8C%85%E5%90%AB%E4%B8%80%E5%80%8B%E8%A8%88%E7%AE%97%E5%BE%9E%E6%AF%8F%E5%80%8B%E6%89%B9%E6%AC%A1%E9%96%8B%E5%A7%8B%E7%9A%84%E6%8C%81%E7%BA%8C%E6%99%82%E9%96%93%E7%9A%84%E5%85%AC%E5%BC%8F%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22batch.PNG%22%20style%3D%22width%3A%20489px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22batch.PNG%22%20style%3D%22width%3A%20489px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22batch.PNG%22%20style%3D%22width%3A%20489px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F29068i42B0C273DFD97746%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22batch.PNG%22%20alt%3D%22batch.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here(%201%20)%3B%0Adt%20%3D%20Current%20Data%20Table()%3B%0Adt%20%26lt%3B%26lt%3B%20New%20Column(%20%22Duration%22%2C%0A%20Format(%20%22%3Aday%3Ahr%3Am%3As%22%2C%2021%2C%203%20)%2C%0A%20formula(%0A%20%20If(%20Row()%20%3D%3D%201%20%7C%20%3ABatch%20!%3D%20Lag(%20%3ABatch%20)%2C%0A%20%20%20start%20%3D%20%3ATimestamp%0A%20%20)%3B%0A%20%20%3ATimestamp%20-%20start%3B%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
MK1985
Level I

How to convert timestamp data to duration time for each batch using jsl script

Hi all,

 

I have started using JSL and is currently on a beginner level.

My data consists of time-series batch data for different process variables. Each batch has a different time series range/ processing time. Data resolution is 1 hr.

MK1985_0-1608641051958.png

 

 

First, I want to convert the batch start time (Real-time) into duration time starting at time point zero (0) and then accumulate to the end Real-time. I think I manage to do that using a script that I found online. However, this only works for the first batch.

For the second batch, the Real-time conversion into duration time does not start at time point zero.

Question: How can I make/modify the script, so it takes into consideration for each batch ID and the respective processing time?              

 

Thanks in advance

 

SCRIPT

names default to here (1);
dt = current data table ();
dt << New Column( "Duration",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
If( Row() == 1, 0, :TimeStamp - :TimeStamp[1] ) / 60


)
);
2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: How to convert timestamp data to duration time for each batch using jsl script

Here is the simple script that creates a new column with a formula that calculates the duration from the beginning of each batch

batch.PNG

names default to here( 1 );
dt = Current Data Table();
dt << New Column( "Duration",
	Format( ":day:hr:m:s", 21, 3 ),
	formula(
		If( Row() == 1 | :Batch != Lag( :Batch ),
			start = :Timestamp
		);
		:Timestamp - start;
	)
);
Jim

View solution in original post

Re: How to convert timestamp data to duration time for each batch using jsl script

This alternative uses a built-in function, Col Minimum( x, group ).

 

Screen Shot 2020-12-22 at 12.33.16 PM.png

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: How to convert timestamp data to duration time for each batch using jsl script

Here is the simple script that creates a new column with a formula that calculates the duration from the beginning of each batch

batch.PNG

names default to here( 1 );
dt = Current Data Table();
dt << New Column( "Duration",
	Format( ":day:hr:m:s", 21, 3 ),
	formula(
		If( Row() == 1 | :Batch != Lag( :Batch ),
			start = :Timestamp
		);
		:Timestamp - start;
	)
);
Jim

Re: How to convert timestamp data to duration time for each batch using jsl script

This alternative uses a built-in function, Col Minimum( x, group ).

 

Screen Shot 2020-12-22 at 12.33.16 PM.png

MK1985
Level I

Re: How to convert timestamp data to duration time for each batch using jsl script

Thanks a lot Mark. It is working very well. Merry Christmas