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.

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
)
);
Thanks a lot Mark. It is working very well. Merry Christmas 
This alternative uses a built-in function, Col Minimum( x, group ).

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

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;
)
);