<?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: Skip below lines if a table is empty inside a for loop in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52930#M29957</link>
    <description>&lt;P&gt;What are you using the Is Empty() function to do?&amp;nbsp;&amp;nbsp;If it is to check if the table itself has no data in it, you are using this function incorrectly.&amp;nbsp; It will tell you if the variable mydt (not the data table it references) has no value or has the empty value.&amp;nbsp; If you want to check if the data table has nothing in it, then do something like N Row(mydt) == 0 as your logical check.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Mar 2018 16:51:29 GMT</pubDate>
    <dc:creator>cwillden</dc:creator>
    <dc:date>2018-03-09T16:51:29Z</dc:date>
    <item>
      <title>Skip below lines if a table is empty inside a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52830#M29921</link>
      <description>&lt;P class="p1"&gt;&amp;nbsp;Hi, I have the following script which is inside a for loop. I like to continue the loop if table mydt is empty and skip lines below it.&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;I appreciate your help. Thanks&lt;/P&gt;&lt;P class="p1"&gt;-------------------------------------------&lt;/P&gt;&lt;P class="p2"&gt;mydt = &lt;SPAN class="s1"&gt;Data Table&lt;/SPAN&gt;( dt5 );&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;if&lt;/SPAN&gt;((&lt;SPAN class="s1"&gt;is empty&lt;/SPAN&gt;(mydt)), continue());&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;mydtsummary = &lt;SPAN class="s1"&gt;Data Table&lt;/SPAN&gt;( dt5 ) &amp;lt;&amp;lt; &lt;SPAN class="s2"&gt;Summary&lt;/SPAN&gt;(&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;Group( :BoardNo ),&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s1"&gt;Max&lt;/SPAN&gt;( :starttime ),&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;statistics column name format( &lt;SPAN class="s3"&gt;"stat of column"&lt;/SPAN&gt; )&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;);&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;mydt &amp;lt;&amp;lt; &lt;SPAN class="s2"&gt;Update&lt;/SPAN&gt;(&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;With( &lt;SPAN class="s1"&gt;Data Table&lt;/SPAN&gt;( mydtsummary ) ),&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;Match Columns( :BoardNo = :BoardNo ),&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;Add Columns from Update table( :Max of starttime )&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;);&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;mydt &amp;lt;&amp;lt; &lt;SPAN class="s2"&gt;select where&lt;/SPAN&gt;( :starttime == :Max of starttime ) &amp;lt;&amp;lt; &lt;SPAN class="s2"&gt;invert row selection&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN class="s4"&gt;mydt &amp;lt;&amp;lt; &lt;/SPAN&gt;delete rows&lt;SPAN class="s4"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN class="s4"&gt;mydt &amp;lt;&amp;lt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;delete columns&lt;/SPAN&gt;&lt;SPAN class="s4"&gt;( &lt;/SPAN&gt;"Max of starttime"&lt;SPAN class="s4"&gt; );&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s1"&gt;Close&lt;/SPAN&gt;( mydtsummary, nosave );&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s1"&gt;Close&lt;/SPAN&gt;(mydt,save);&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 18:42:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52830#M29921</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-03-08T18:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Skip below lines if a table is empty inside a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52841#M29926</link>
      <description>&lt;P&gt;Why not just reverse the logic using "!" and stick all those lines in your if statement?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( !Is Empty( mydt ),
	mydtsummary = Data Table( dt5 ) &amp;lt;&amp;lt; Summary(
		Group( :BoardNo ),
		Max( :starttime ),
		statistics column name format( "stat of column" )
	);

	mydt &amp;lt;&amp;lt; Update(
		With( Data Table( mydtsummary ) ),
		Match Columns( :BoardNo = :BoardNo ),
		Add Columns from Update table( :Max of starttime )
	);

	mydt &amp;lt;&amp;lt; select where( :starttime == :Max of starttime ) &amp;lt;&amp;lt; invert row selection;

	mydt &amp;lt;&amp;lt; delete rows;

	mydt &amp;lt;&amp;lt; delete columns( "Max of starttime" );

	Close( mydtsummary, nosave );
	Close( mydt, save );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Mar 2018 19:35:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52841#M29926</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-03-08T19:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Skip below lines if a table is empty inside a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52863#M29935</link>
      <description>&lt;P&gt;Thanks for quick feedback and solution. I tried it but I get an error in the update section.&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;missing argument{8} in access or evaluation of 'Data Table' , Data Table&lt;SPAN class="s1"&gt;/*###*/&lt;/SPAN&gt;(mydtsummary)&lt;/P&gt;&lt;P class="p1"&gt;mydt &amp;lt;&amp;lt; Update(&lt;/P&gt;&lt;P class="p1"&gt;With( Data Table&lt;SPAN class="s1"&gt;/*###*/&lt;/SPAN&gt;(mydtsummary) ),&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Looks like it is processing Update section when mydt is empty and it should not. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 21:31:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52863#M29935</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-03-08T21:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Skip below lines if a table is empty inside a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52930#M29957</link>
      <description>&lt;P&gt;What are you using the Is Empty() function to do?&amp;nbsp;&amp;nbsp;If it is to check if the table itself has no data in it, you are using this function incorrectly.&amp;nbsp; It will tell you if the variable mydt (not the data table it references) has no value or has the empty value.&amp;nbsp; If you want to check if the data table has nothing in it, then do something like N Row(mydt) == 0 as your logical check.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 16:51:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52930#M29957</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-03-09T16:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Skip below lines if a table is empty inside a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52936#M29959</link>
      <description>&lt;P&gt;Thanks Cameron. The issue is not whether the table is empty or has no value. the issue, if the condition is true, I want to skip all the lines below that and go to the next for loop index.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (condition = True,&lt;/P&gt;&lt;P&gt;&amp;nbsp;....&lt;/P&gt;&lt;P&gt;&amp;nbsp;...&amp;nbsp; &amp;nbsp; skip all below&lt;/P&gt;&lt;P&gt;&amp;nbsp;...&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 18:49:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52936#M29959</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-03-09T18:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Skip below lines if a table is empty inside a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52937#M29960</link>
      <description>&lt;P&gt;If( condition == true,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Break();&lt;/P&gt;
&lt;P&gt;);&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 18:52:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52937#M29960</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-03-09T18:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Skip below lines if a table is empty inside a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52957#M29963</link>
      <description>&lt;P&gt;Thanks Jim.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 21:21:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Skip-below-lines-if-a-table-is-empty-inside-a-for-loop/m-p/52957#M29963</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-03-09T21:21:29Z</dc:date>
    </item>
  </channel>
</rss>

