<?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: Need a column based on selective condition on other columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467340#M71123</link>
    <description>&lt;P&gt;Thanks George,&lt;BR /&gt;It is working fine. I forget to put everything in&amp;nbsp; "Formula ( )". thanks again.&lt;/P&gt;</description>
    <pubDate>Sun, 06 Mar 2022 09:51:34 GMT</pubDate>
    <dc:creator>HSS</dc:creator>
    <dc:date>2022-03-06T09:51:34Z</dc:date>
    <item>
      <title>Need a column based on selective condition on other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/466927#M71071</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;I am looking for % of fails in measurement procedure. My requirement and sample data is below.&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="HSS_0-1646382549163.png" style="width: 735px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40527iDD8D3F91E0BB16ED/image-dimensions/735x318?v=v2" width="735" height="318" role="button" title="HSS_0-1646382549163.png" alt="HSS_0-1646382549163.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help here?&lt;BR /&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:12:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/466927#M71071</guid>
      <dc:creator>HSS</dc:creator>
      <dc:date>2023-06-09T18:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need a column based on selective condition on other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467217#M71106</link>
      <description>&lt;P&gt;The most tricky part here is to define a proper grouping column (see Avg_Time and concatenated with Sample --&amp;gt; Group).&lt;/P&gt;
&lt;P&gt;This is similar to your "count" concatenated with Sample.&lt;/P&gt;
&lt;P&gt;If I would need to calculate the requirements, I would do it like shown in the table in Column "Result". Behind the scenes it tries to find in each row: all rows belonging to the same group, and shows the measurement Points in column "Measurement in Group".&lt;/P&gt;
&lt;P&gt;Please see attached table for the details.&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="Georg_0-1646426953083.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40562i3D9967C0570414E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Georg_0-1646426953083.png" alt="Georg_0-1646426953083.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 20:56:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467217#M71106</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2022-03-04T20:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need a column based on selective condition on other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467265#M71109</link>
      <description>&lt;P&gt;Hi Georg,&lt;BR /&gt;It seems working fine in table column Formula. But I am not able to make it into a script. In also tried similar approach based on For loop and different column but I am not able to generate pattern of measurements to get the final results. Here is the script I am trying --&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/////////////////////////////////////////////////////////////////
dt = Current Data Table();
dt &amp;lt;&amp;lt; New Column( "Pattern0",
Expression,
(row_index_lst = {} ; row_Time_A = :Time_A ; row_Sample = :Sample ; threshold = 60 * 15 ;
For Each Row(
If( Abs( :Time_A - row_Time_A ) &amp;lt; threshold &amp;amp; :Sample == row_Sample,
Insert Into( row_index_lst, Row() )
)
));
(:Measurement &amp;lt;&amp;lt; get values)[row_index_lst];
);

///////////////////////////////////////////


// similar approach but based on different column and For loop--


//////////////////////////////////////////////////////
dt &amp;lt;&amp;lt; New Column( "Pattren",
Expression,
For( i = 1, i &amp;lt;= N Rows( dt ), i++,
Row_List = {};
If(
:Count == Lag( :Count, -1 ) &amp;amp; :Sample == Lag( :Sample, -1 ) | :Count == Lag( :Count, 1 ) &amp;amp;
:Sample == Lag( :Sample, 1 ),
Insert Into( Row_List, Row() )
);
(:Measurement &amp;lt;&amp;lt; get values)[Row_List];
)
);
/////////////////////////////////////////////////////////////&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both are giving just empty columns. Any suggestion how can I convert your formula to a script ?&lt;BR /&gt;Thanks again.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 07:45:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467265#M71109</guid>
      <dc:creator>HSS</dc:creator>
      <dc:date>2022-03-05T07:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need a column based on selective condition on other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467270#M71111</link>
      <description>&lt;P&gt;I'm not really sure what you are going to do.&lt;/P&gt;
&lt;P&gt;If you want to add that calculation to the current data table, the below code will work. You need to put that calculation into "Formula()".&lt;/P&gt;
&lt;P&gt;If you have a column and would like to script it, the best way is always to copy the table script from red triangle menu of table. There you can get and review the script, how to generate the table (or column) by script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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( "Pattern",
	Expression,
	"None",
	Formula(
		(row_index_lst = {} ; row_Time_A = :Time_A ; row_Sample = :Sample ; threshold = 60 * 15 ;
		For Each Row(
			If( Abs( :Time_A - row_Time_A ) &amp;lt; threshold &amp;amp; :Sample == row_Sample,
				Insert Into( row_index_lst, Row() )
			)
		));
		(:Measurement &amp;lt;&amp;lt; get values)[row_index_lst];
	),
	Set Display Width( 232 )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 16:59:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467270#M71111</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2022-03-05T16:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need a column based on selective condition on other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467340#M71123</link>
      <description>&lt;P&gt;Thanks George,&lt;BR /&gt;It is working fine. I forget to put everything in&amp;nbsp; "Formula ( )". thanks again.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 09:51:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-column-based-on-selective-condition-on-other-columns/m-p/467340#M71123</guid>
      <dc:creator>HSS</dc:creator>
      <dc:date>2022-03-06T09:51:34Z</dc:date>
    </item>
  </channel>
</rss>

