<?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: closing all data tables but leave one open for further analysis in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79925#M36843</link>
    <description>&lt;P&gt;Phil I was thinking the same thing.&amp;nbsp; It's important to note that table names can't be duplicates, so if you try and create a new table names "dt4" and there is already a "dt4" table, JMP will name it "dt4 2".&amp;nbsp; Table names are not likely to be what you expect, which is another reason I feel the code above is a poor way to solve the problem at hand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just looked at the post linked in the original post.&amp;nbsp; Uday's code is much more production ready.&amp;nbsp; Unfortunately, the OP is using txnelson's simplification, which is just that a simplification and is where he's having all his issues.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Oct 2018 15:20:01 GMT</pubDate>
    <dc:creator>msharp</dc:creator>
    <dc:date>2018-10-22T15:20:01Z</dc:date>
    <item>
      <title>closing all data tables but leave one open for further analysis</title>
      <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79913#M36834</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a follow up on the post:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Post " href="https://community.jmp.com/t5/Discussions/JSL-How-to-close-data-tables-after-analysis/m-p/36739" target="_self"&gt;https://community.jmp.com/t5/Discussions/JSL-How-to-close-data-tables-after-analysis/m-p/36739&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I have encountered an error on my script while running JSL Debgger.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;DontClose = ("dt4");   // Example names of tables you want to leave
// Loop backwards through the list, so the table numbers do not change
For( i = N Table(), i &amp;gt;= 0, i--, 
	If( Contains( DontClose, Data Table( i ) &amp;lt;&amp;lt; get name ),
		Continue(),
		Close( Data Table( i ), "No Save" )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The script runs fine as in closes all the tables except dt4 but I get an error as shown on the file attached under the If statement. Does anyone have a clue what this is reffering to?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script runs fine and closes all the tables except dt4, however, I am having issues&amp;nbsp;when extending the script after this point. I have a graph builder script to be launched after this point for the dt4 table but it does not do anything. SO I am wondering if this error here is stopping the script to continue to the next steps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 13:57:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79913#M36834</guid>
      <dc:creator>ivomdb</dc:creator>
      <dc:date>2018-10-22T13:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: closing all data tables but leave one open for further analysis</title>
      <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79914#M36835</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10896"&gt;@ivomdb&lt;/a&gt;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; The error you see typically occurs if you are referring to a data table which JMP does not know exists or has no reference to access the table by. This happens mostly when the data table reference is lost or has been closed before it is being referenced.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; One way to address this issue is by doing the following.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; You should also try and make sure that the table is not being closed prematurely.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;DontClose = ("dt4");   // Example names of tables you want to leave
// Loop backwards through the list, so the table numbers do not change
For( i = N Table(), i &amp;gt;= 0, i--, 
        Current Data Table(Data Table(i)); // This should make the data table you are working with active and current 
	If( Contains( DontClose, Data Table( i ) &amp;lt;&amp;lt; get name ),
		Continue();
                 ,
                // else 
		Close( Data Table( i ), "No Save" ); 
	)
);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Oct 2018 14:05:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79914#M36835</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-10-22T14:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: closing all data tables but leave one open for further analysis</title>
      <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79918#M36838</link>
      <description>&lt;P&gt;Hi Uday,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have changed this but still get the same error under JSL Debugger.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 14:36:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79918#M36838</guid>
      <dc:creator>ivomdb</dc:creator>
      <dc:date>2018-10-22T14:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: closing all data tables but leave one open for further analysis</title>
      <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79920#M36839</link>
      <description>&lt;P&gt;Your tables could be linked tables. See below example.&amp;nbsp; That or there's an error with your script and your referencing the wrong table by accident.&amp;nbsp; This is likely since you are looking for tables by name.&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 );
dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 = dt1 &amp;lt;&amp;lt; Summary(
	Group( :height ),
	Freq( "None" ),
	Weight( "None" )
);
close(dt1, "nosave"); //closes both dt1 and dt2 since dt2 is dependant on dt1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either way, the code above is a poor way to handle closing tables.&amp;nbsp; First, you will close tables not related to your script, potentially making users mad that you closed the other things they were working on.&amp;nbsp; Second, leaving tables you don't need till the end to close is an inefficient use of memory.&amp;nbsp; It would be a better practice/pattern to close tables right after use instead of waiting till the end of the script.&amp;nbsp; If the tables are needed for the entire script, then I would recommend keeping track of the tables in a list so you only close the ones related to your script.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 15:05:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79920#M36839</guid>
      <dc:creator>msharp</dc:creator>
      <dc:date>2018-10-22T15:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: closing all data tables but leave one open for further analysis</title>
      <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79921#M36840</link>
      <description>&lt;P&gt;Is "dt4" the actual name of&amp;nbsp;your table?&amp;nbsp;It sounds more likely that it is&amp;nbsp;the variable name that you have defined for the table in your script? I think&amp;nbsp;your script is looking for the table name, i.e. what you see at the top of the JMP table, e.g. "Big Class":&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Table names example.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12949i144BA4762F4E9915/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Table names example.png" alt="Table names example.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;This is a simple example (from the scripting index) of the Get Name() function that is used in your 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 = Open( "$SAMPLE_DATA/Big Class.jmp" );
n = dt &amp;lt;&amp;lt; Get Name();
Show( n );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW,&amp;nbsp; I could be wrong about this being the cause of your problem!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 15:07:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79921#M36840</guid>
      <dc:creator>Phil_Kay</dc:creator>
      <dc:date>2018-10-22T15:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: closing all data tables but leave one open for further analysis</title>
      <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79925#M36843</link>
      <description>&lt;P&gt;Phil I was thinking the same thing.&amp;nbsp; It's important to note that table names can't be duplicates, so if you try and create a new table names "dt4" and there is already a "dt4" table, JMP will name it "dt4 2".&amp;nbsp; Table names are not likely to be what you expect, which is another reason I feel the code above is a poor way to solve the problem at hand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just looked at the post linked in the original post.&amp;nbsp; Uday's code is much more production ready.&amp;nbsp; Unfortunately, the OP is using txnelson's simplification, which is just that a simplification and is where he's having all his issues.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 15:20:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/79925#M36843</guid>
      <dc:creator>msharp</dc:creator>
      <dc:date>2018-10-22T15:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: closing all data tables but leave one open for further analysis</title>
      <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/80217#M36896</link>
      <description>&lt;P&gt;Thanks for the advice. I have changed the approach and now I close the data tables earlier on the script. The script is actually faster now. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 11:37:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/80217#M36896</guid>
      <dc:creator>ivomdb</dc:creator>
      <dc:date>2018-10-24T11:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: closing all data tables but leave one open for further analysis</title>
      <link>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/80218#M36897</link>
      <description>&lt;P&gt;it's because you're &amp;gt;= 0.&amp;nbsp; There is no data table 0&lt;/P&gt;
&lt;P&gt;either make it &amp;gt;= 1 or &amp;gt;0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;DontClose = ("dt4");   // Example names of tables you want to leave
// Loop backwards through the list, so the table numbers do not change
For( i = N Table(), i &amp;gt;= 1, i--, 
	If( Contains( DontClose, Data Table( i ) &amp;lt;&amp;lt; get name ),
		Continue(),
		Close( Data Table( i ), "No Save" )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Oct 2018 12:13:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/closing-all-data-tables-but-leave-one-open-for-further-analysis/m-p/80218#M36897</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2018-10-24T12:13:31Z</dc:date>
    </item>
  </channel>
</rss>

