<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to convert timestamp data to duration time for each batch using jsl script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/343850#M59331</link>
    <description>&lt;P&gt;This alternative uses a built-in function, Col Minimum( x, group ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-12-22 at 12.33.16 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29072i2F7DF492EF3F1C04/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-12-22 at 12.33.16 PM.png" alt="Screen Shot 2020-12-22 at 12.33.16 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2020 17:34:52 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2020-12-22T17:34:52Z</dc:date>
    <item>
      <title>How to convert timestamp data to duration time for each batch using jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/343733#M59315</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have started using JSL and is currently on a beginner level.&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MK1985_0-1608641051958.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29067iB9CB504FC0439D52/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MK1985_0-1608641051958.png" alt="MK1985_0-1608641051958.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;For the second batch, the Real-time conversion into duration time does not start at time point zero.&lt;/P&gt;
&lt;P&gt;Question: How can I make/modify the script, so it takes into consideration for each batch ID and the respective processing time?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SCRIPT&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here (1);
dt = current data table ();
dt &amp;lt;&amp;lt; New Column( "Duration",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
If( Row() == 1, 0, :TimeStamp - :TimeStamp[1] ) / 60


)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:01:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/343733#M59315</guid>
      <dc:creator>MK1985</dc:creator>
      <dc:date>2023-06-09T22:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert timestamp data to duration time for each batch using jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/343753#M59316</link>
      <description>&lt;P&gt;Here is the simple script that creates a new column with a formula that calculates the duration from the beginning of each batch&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="batch.PNG" style="width: 489px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29068i42B0C273DFD97746/image-size/large?v=v2&amp;amp;px=999" role="button" title="batch.PNG" alt="batch.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here( 1 );
dt = Current Data Table();
dt &amp;lt;&amp;lt; New Column( "Duration",
	Format( ":day:hr:m:s", 21, 3 ),
	formula(
		If( Row() == 1 | :Batch != Lag( :Batch ),
			start = :Timestamp
		);
		:Timestamp - start;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Dec 2020 13:15:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/343753#M59316</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-12-22T13:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert timestamp data to duration time for each batch using jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/343850#M59331</link>
      <description>&lt;P&gt;This alternative uses a built-in function, Col Minimum( x, group ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-12-22 at 12.33.16 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29072i2F7DF492EF3F1C04/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-12-22 at 12.33.16 PM.png" alt="Screen Shot 2020-12-22 at 12.33.16 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 17:34:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/343850#M59331</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-12-22T17:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert timestamp data to duration time for each batch using jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/344002#M59355</link>
      <description>&lt;P&gt;Thanks a lot Mark. It is working very well. Merry Christmas :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 09:28:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-convert-timestamp-data-to-duration-time-for-each-batch/m-p/344002#M59355</guid>
      <dc:creator>MK1985</dc:creator>
      <dc:date>2020-12-23T09:28:33Z</dc:date>
    </item>
  </channel>
</rss>

