<?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 How to connect formulas to dedicated colums instead of row number in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-connect-formulas-to-dedicated-colums-instead-of-row/m-p/386153#M63627</link>
    <description>&lt;P&gt;Hey everybody,&lt;/P&gt;&lt;P&gt;From my predecessor I inherit some data files with these kind of formulas (see also attached file):&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Example Formula.jpg" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32919iB7BE6B785C57E3AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Example Formula.jpg" alt="Example Formula.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Match( :Phase,
	"Preparation", (:Date_time[2] - :Date_time[1]) / 3600,
	"Cultivation", (:Date_time[5] - :Date_time[3]) / 3600,
	"Harvest", (:Date_time[7] - :Date_time[6]) / 3600
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to exchange the row numbers with dedicated Timepoints, so that it doesn't matter at what row of the table the data is.&lt;/P&gt;&lt;P&gt;In my head it looks like: "Cultivation", (:Date_time[:Timepoint == "End"] -&amp;nbsp;:Date_time[:Timepoint == "Inoculation"]) / 3600&lt;/P&gt;&lt;P&gt;Unfortunately this doesn't work and I don't find any suitable code. Can you help me with it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx,&lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: as I am new to Scripting in general and JMP in special, please excuse me if I use the wrong language or ask stupid questions.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:30:22 GMT</pubDate>
    <dc:creator>mkunzi</dc:creator>
    <dc:date>2023-06-10T23:30:22Z</dc:date>
    <item>
      <title>How to connect formulas to dedicated colums instead of row number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-connect-formulas-to-dedicated-colums-instead-of-row/m-p/386153#M63627</link>
      <description>&lt;P&gt;Hey everybody,&lt;/P&gt;&lt;P&gt;From my predecessor I inherit some data files with these kind of formulas (see also attached file):&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Example Formula.jpg" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32919iB7BE6B785C57E3AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Example Formula.jpg" alt="Example Formula.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Match( :Phase,
	"Preparation", (:Date_time[2] - :Date_time[1]) / 3600,
	"Cultivation", (:Date_time[5] - :Date_time[3]) / 3600,
	"Harvest", (:Date_time[7] - :Date_time[6]) / 3600
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to exchange the row numbers with dedicated Timepoints, so that it doesn't matter at what row of the table the data is.&lt;/P&gt;&lt;P&gt;In my head it looks like: "Cultivation", (:Date_time[:Timepoint == "End"] -&amp;nbsp;:Date_time[:Timepoint == "Inoculation"]) / 3600&lt;/P&gt;&lt;P&gt;Unfortunately this doesn't work and I don't find any suitable code. Can you help me with it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx,&lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: as I am new to Scripting in general and JMP in special, please excuse me if I use the wrong language or ask stupid questions.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:30:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-connect-formulas-to-dedicated-colums-instead-of-row/m-p/386153#M63627</guid>
      <dc:creator>mkunzi</dc:creator>
      <dc:date>2023-06-10T23:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect formulas to dedicated colums instead of row number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-connect-formulas-to-dedicated-colums-instead-of-row/m-p/386185#M63628</link>
      <description>&lt;P&gt;To get the row numbers you need, you can use Loc() or Contains functions. Below is an example using Contains()&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Match(:Phase,
	"Preparation", (:Date_time[2] - :Date_time[1]) / 3600,
	"Cultivation", (:Date_time[Contains(:Timepoint &amp;lt;&amp;lt; get as matrix, "End")] - :Date_time[Contains(:Timepoint &amp;lt;&amp;lt; get as matrix, "Inocultation")]) / 3600,
	"Harvest", (:Date_time[7] - :Date_time[6]) / 3600
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Not exactly answer to your question, but in this case you could maybe use something like this (if you only need first and last times per Phase):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;(Col Max(:Date_time, :Phase) - Col Min(:Date_time, :Phase)) / In Hours(1)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 May 2021 09:08:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-connect-formulas-to-dedicated-colums-instead-of-row/m-p/386185#M63628</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-05-18T09:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect formulas to dedicated colums instead of row number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-connect-formulas-to-dedicated-colums-instead-of-row/m-p/386326#M63638</link>
      <description>&lt;P&gt;Wow, that was quick.&lt;/P&gt;&lt;P&gt;Thak you&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;for your help, it is exactly what I was looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As it is not always Beginn and End I decided for the following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Match( :Phase,
	"Cultivation",(:Date_time[Loc( :Timepoint &amp;lt;&amp;lt; get as matrix, "End" )] - :Date_time[Loc( :Timepoint &amp;lt;&amp;lt; get as matrix, "Inocultation" )]) / In Hours( 1 )
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I chose Loc, because I understand it as Location and now it is easy readable.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 13:43:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-connect-formulas-to-dedicated-colums-instead-of-row/m-p/386326#M63638</guid>
      <dc:creator>mkunzi</dc:creator>
      <dc:date>2021-05-18T13:43:20Z</dc:date>
    </item>
  </channel>
</rss>

