<?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: Creation of a new column based on grouping of other columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266295#M51862</link>
    <description>&lt;P&gt;Thank you for your dedicated time to solve this issue, the suggested script yields the following miss-intentions to the created column Sub_Tool_Status:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; &amp;nbsp;Most recent row value yields Replaced (attached file row 91 marked in yellow)&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; &amp;nbsp;Most recent row is empty (Attached file last row)&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; When are several replacements only the last row prior to replacement yields Replaced and it does not update the prior rows (Attached file marked with two green shades)&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 May 2020 06:23:20 GMT</pubDate>
    <dc:creator>DZ_932</dc:creator>
    <dc:date>2020-05-13T06:23:20Z</dc:date>
    <item>
      <title>Creation of a new column based on grouping of other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266218#M51844</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to create a new column "Status" which will return "Active" or "Replaced"&amp;nbsp; based on the following specification (attached part of the table with "Status" column as illustration of expected result).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each TOOL and Site can replace different Sub_Tool during time and runs several units with its time stamp. The most recent Sub_Tool for the specific Tool and Site should receive Active on the status column and all previous Sub_Tool which where used on that tool and site should receive Replaced.&lt;/P&gt;&lt;P&gt;As on the example attached same Sub_Tool might repeat over time but only on last runs should be marked as Active.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Real file has many tools and each tool has many sites so need a robust coding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help is much appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 20:21:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266218#M51844</guid>
      <dc:creator>DZ_932</dc:creator>
      <dc:date>2020-05-12T20:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of a new column based on grouping of other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266244#M51847</link>
      <description>From my reading of your definition, I can come up with row 36 being considered as Active, but other than seeing that row 28 through 35 has the save SubTool value, I don't understand why those rows should be marked as Active.  &lt;BR /&gt;Or, is what you want to do, a simple matter of finding out what the last SubTool was used for the Tool and Site, and then mark as active all rows back to when the SubTool changes?????&lt;BR /&gt;I am confused</description>
      <pubDate>Tue, 12 May 2020 21:09:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266244#M51847</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-12T21:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of a new column based on grouping of other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266250#M51851</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The original table will have many other columns on which I will be calculating statistics with the Sub_Tool hence not only the last row needs to be marked as Acitve but the entire batch on which the latest Sub_Tool ran. Than yes, I need to&amp;nbsp;&lt;SPAN&gt;finde out what the last SubTool was used for the Tool and Site, and then mark as active all rows back to when the SubTool changes.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 21:51:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266250#M51851</guid>
      <dc:creator>DZ_932</dc:creator>
      <dc:date>2020-05-12T21:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of a new column based on grouping of other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266278#M51858</link>
      <description>&lt;P&gt;Here is one of several ways that can probably get the new column calculated.&amp;nbsp; Just create a new character column, paste the below formula into the new column, and change the references to "Active2" to whatever the name of the new column you created is.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() &amp;gt; 1,
	If( :TOOL != Lag( :TOOL ) | :Site != Lag( :Site ) | Row() == N Rows( Current Data Table() ),
		TargetValue = :Sub_Tool[Row() - 1];
		:Active2[Row() - 1] = "Active";
		For( i = Row() - 2, i &amp;gt;= 1, i--,
			If( :Sub_Tool[i] == TargetValue,
				:Active2[i] = "Active",
				:Active2[i] = "Replaced";
				Break();
			)
		);
	)
);
If( Row() == N Rows( Current Data Table() ),
	"Active",
	"Replaced"
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 01:19:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266278#M51858</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-13T01:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of a new column based on grouping of other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266295#M51862</link>
      <description>&lt;P&gt;Thank you for your dedicated time to solve this issue, the suggested script yields the following miss-intentions to the created column Sub_Tool_Status:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; &amp;nbsp;Most recent row value yields Replaced (attached file row 91 marked in yellow)&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; &amp;nbsp;Most recent row is empty (Attached file last row)&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; When are several replacements only the last row prior to replacement yields Replaced and it does not update the prior rows (Attached file marked with two green shades)&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 06:23:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266295#M51862</guid>
      <dc:creator>DZ_932</dc:creator>
      <dc:date>2020-05-13T06:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of a new column based on grouping of other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266330#M51871</link>
      <description>&lt;P&gt;Thank you for the more complete test file and for your testing of my initial code.&lt;/P&gt;
&lt;P&gt;Here is a new version of the format&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() &amp;gt; 1,
	If( :TOOL != Lag( :TOOL ) | :SITE != Lag( :SITE ) | Row() == N Rows( Current Data Table() ),
		TargetValue = :SUB_TOOL[Row() - 1];
		:Active2[Row() - 1] = "Active";
		For( i = Row() - 1, i &amp;gt;= 1, i--,
			If( :SUB_TOOL[i] == TargetValue,
				:Active2[i] = "Active",
				Break()
			)
		);
	)
);
If( Row() == N Rows( Current Data Table() ),
	"Active",
	"Replaced"
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will need to change the column references in the code of "Active2" to the column name you are giving the column.&lt;/P&gt;
&lt;P&gt;Now my question to you is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Do you understand how the formula work?&lt;/P&gt;
&lt;P&gt;If not, you need to study the code and ask question about the code, so you understand it, and can make changes in the future that may be necessary.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 09:56:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-a-new-column-based-on-grouping-of-other-columns/m-p/266330#M51871</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-13T09:56:28Z</dc:date>
    </item>
  </channel>
</rss>

