<?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 assign and increment an iteration count for multiple variables with unequal rows? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/580073#M78726</link>
    <description>&lt;P&gt;Here is other option for a formula&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Cumulative Sum(
	Col Min(Row(), :SN) == Row() | Lag(:Comment) == "End of Cycle",
	:SN
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 12 Dec 2022 06:53:09 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-12-12T06:53:09Z</dc:date>
    <item>
      <title>How to assign and increment an iteration count for multiple variables with unequal rows?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579519#M78679</link>
      <description>&lt;P&gt;Hello all.&lt;/P&gt;&lt;P&gt;Im trying to create a column which assigns an iteration number (numeric and continuous) based on column "Comment = End of Cycle" and increments it for the same SN. The number of data points for each SN is not the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example.&lt;/P&gt;&lt;P&gt;for SN = "A", rows 1-9: Iteration =1, rows 10-16&amp;nbsp;Iteration =2&lt;/P&gt;&lt;P&gt;for SN = "B", rows 17-27: Iteration =1, rows 28-36&amp;nbsp;Iteration =2 and so on...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried a few variations using the&amp;nbsp; Row ( ) function but was not successful. Can someone provide some guidance on this?&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="sumanthcb141977_0-1670610517460.png" style="width: 286px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48106i63EADB19E343B1DC/image-dimensions/286x806?v=v2" width="286" height="806" role="button" title="sumanthcb141977_0-1670610517460.png" alt="sumanthcb141977_0-1670610517460.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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:58:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579519#M78679</guid>
      <dc:creator>sumanthcb141977</dc:creator>
      <dc:date>2023-06-10T23:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign and increment an iteration count for multiple variables with unequal rows?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579531#M78680</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/45716"&gt;@sumanthcb141977&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;please try the following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "Untitled",
	Add Rows( 36 ),
	New Column( "SN",
		Character,
		"Nominal",
		Set Values(
			{"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
			"A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B",
			"B", "B", "B", "B", "B", "B", "B", "B"}
		)
	),
	New Column( "iteration",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
			1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2]
		)
	),
	New Column( "iteration count",
		Numeric,
		"Nominal",
		Format( "Best", 9 ),
		Formula( Col Cumulative Sum( 1, :SN, :iteration ) )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If this is not what you are looking for please provide the data table so it is much easier to address.&lt;BR /&gt;let us know if it worked&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 18:56:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579531#M78680</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2022-12-09T18:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign and increment an iteration count for multiple variables with unequal rows?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579538#M78681</link>
      <description>&lt;P&gt;Thanks for the response. Sorry had to be more specific. I dont need an additional column by the name of iteration count. I wanted the formula for the iteration to assign a number and increment it based on the "end of cycle" comment. Below is the image of what i wanted the iteration column to look like.&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="sumanthcb141977_1-1670612810541.png" style="width: 254px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48108i62C897F1C17683AC/image-dimensions/254x806?v=v2" width="254" height="806" role="button" title="sumanthcb141977_1-1670612810541.png" alt="sumanthcb141977_1-1670612810541.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Im attaching the jmp file per the request.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 19:09:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579538#M78681</guid>
      <dc:creator>sumanthcb141977</dc:creator>
      <dc:date>2022-12-09T19:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign and increment an iteration count for multiple variables with unequal rows?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579555#M78682</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/45716"&gt;@sumanthcb141977&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try the following. it is not robust and requires the data to be sorted by SN and then date.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "Untitled",
	Add Rows( 36 ),
	New Column( "SN",
		Character,
		"Nominal",
		Set Values(
			{"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
			"A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B",
			"B", "B", "B", "B", "B", "B", "B", "B"}
		)
	),
	New Column( "Comment",
		Character,
		"Nominal",
		Set Values(
			{"Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle",
			"End of Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle",
			"End of Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle",
			"Cycle", "Cycle", "Cycle", "Cycle", "End of Cycle", "Cycle", "Cycle",
			"Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle"}
		)
	),
	New Column( "iteration count",
		Numeric,
		"Nominal",
		Format( "Best", 9 ),
		Formula(
			If(
				Row() == 1, 1,
				Lag( :SN ) == :SN &amp;amp; Lag( :Comment ) == "Cycle",
					Lag( :iteration count ),
				Lag( :SN ) == :SN &amp;amp; Lag( :Comment ) == "End of Cycle",
					Lag( :iteration count ) + 1,
				Lag( :SN ) != :SN &amp;amp; Lag( :Comment ) == "End of Cycle", 1
			)
		),
		Set Selected
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;perhaps others have a more robust way of indexing this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 20:02:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579555#M78682</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2022-12-09T20:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign and increment an iteration count for multiple variables with unequal rows?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579804#M78705</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/45716"&gt;@sumanthcb141977&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my only other idea would be to use an additional table. perhaps use new table as is an use its value as place markers. this will allow you to have one table or numeric values and another with categories. this will reduce the hard conversions between numbers and categories.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 11:33:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/579804#M78705</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2022-12-10T11:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign and increment an iteration count for multiple variables with unequal rows?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/580073#M78726</link>
      <description>&lt;P&gt;Here is other option for a formula&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Cumulative Sum(
	Col Min(Row(), :SN) == Row() | Lag(:Comment) == "End of Cycle",
	:SN
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Dec 2022 06:53:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/580073#M78726</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-12-12T06:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign and increment an iteration count for multiple variables with unequal rows?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/580243#M78734</link>
      <description>&lt;P&gt;Thanks for the recommendation. The data is sorted by SN and date which makes it easier.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 15:00:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-and-increment-an-iteration-count-for-multiple/m-p/580243#M78734</guid>
      <dc:creator>sumanthcb141977</dc:creator>
      <dc:date>2022-12-12T15:00:50Z</dc:date>
    </item>
  </channel>
</rss>

