<?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: Is there a way to iterate an If statement on the last row of a table? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264167#M51537</link>
    <description>&lt;P&gt;I would be careful deleting rows from within a formula column.&amp;nbsp; Every time the formula is re-evaluated, it will chop off the last row.&amp;nbsp; However you can create a logical condition for the last row in a column formula using something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == N Row(Current Data Table()), do this, do that);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For your situation, I would run a separate script, not as in a formula column, to cut off the last row so you don't leave that code as a permanent feature of your resulting data table.&amp;nbsp; In that case, the script would pretty much look like what you have.&lt;/P&gt;</description>
    <pubDate>Mon, 04 May 2020 18:19:35 GMT</pubDate>
    <dc:creator>cwillden</dc:creator>
    <dc:date>2020-05-04T18:19:35Z</dc:date>
    <item>
      <title>Is there a way to iterate an If statement on the last row of a table?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264111#M51525</link>
      <description>&lt;P&gt;we have a&amp;nbsp; table that is created from a db query.&amp;nbsp; We use the date/time stamps in this table to determine start/stop times for more detailed queries.&amp;nbsp; The problem we are having is that sometimes the date/time stamps at the end of the table are not a 'matched' set.&amp;nbsp; In this table, we have created formula columns that help us identify which dates are on which row.&amp;nbsp; We know the pattern that we need to have:&amp;nbsp; the last two rows in X_3 need to end in 1 then 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(dt:X_3[NRow(dt)-1] == 0, dt&amp;lt;&amp;lt; deleteRows(NRow(dt)));
If(dt:X_3[NRow(dt)] == 1, dt&amp;lt;&amp;lt; deleteRows(NRow(dt)));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a way to iterate only on the last row until the table has the desired structure?&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 15:39:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264111#M51525</guid>
      <dc:creator>zetunedav</dc:creator>
      <dc:date>2020-05-04T15:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to iterate an If statement on the last row of a table?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264167#M51537</link>
      <description>&lt;P&gt;I would be careful deleting rows from within a formula column.&amp;nbsp; Every time the formula is re-evaluated, it will chop off the last row.&amp;nbsp; However you can create a logical condition for the last row in a column formula using something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == N Row(Current Data Table()), do this, do that);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For your situation, I would run a separate script, not as in a formula column, to cut off the last row so you don't leave that code as a permanent feature of your resulting data table.&amp;nbsp; In that case, the script would pretty much look like what you have.&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 18:19:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264167#M51537</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2020-05-04T18:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to iterate an If statement on the last row of a table?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264189#M51541</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/8582"&gt;@cwillden&lt;/a&gt;&amp;nbsp;Thanks for the input.&amp;nbsp; I'm more interested in the second option.&amp;nbsp; However, the number of rows that need to be trimmed off the bottom varies.&amp;nbsp; I was hoping I could evaluate the last row, delete it and re-valuate the If statement on the 'new' last row in a loop until the Else becomes true.&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 19:37:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264189#M51541</guid>
      <dc:creator>zetunedav</dc:creator>
      <dc:date>2020-05-04T19:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to iterate an If statement on the last row of a table?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264256#M51545</link>
      <description>&lt;P&gt;Just to close the loop on this post for now,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/18774"&gt;@zetunedav&lt;/a&gt;&amp;nbsp;realized we actually work for the same company (and know each other :)&lt;/img&gt; ), so we're going to resolve this in a meeting.&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 20:17:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264256#M51545</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2020-05-04T20:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to iterate an If statement on the last row of a table?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264578#M51580</link>
      <description>&lt;P&gt;In the end, what I needed looked like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;While( continue,
	If( dt:X_3[N Row( dt ) - 1] == 0,
		dt &amp;lt;&amp;lt; deleteRows( N Row( dt ) ),
		continue = 0	
		
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 20:32:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-iterate-an-If-statement-on-the-last-row-of-a/m-p/264578#M51580</guid>
      <dc:creator>zetunedav</dc:creator>
      <dc:date>2020-05-05T20:32:24Z</dc:date>
    </item>
  </channel>
</rss>

