<?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: Data Table evaluation in For Loop from a list in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449107#M69586</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I changed the first two arguments of the For loop accordingly.&amp;nbsp; It should work now:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;OldNames = {"Old Name 1", "Old Name 2", "Old Name 3"};
NewNames = {"New Name 1", "New Name 2", "New Name 3"};

For(
     i=1,

     i &amp;lt;= NItems(NewNames),

     i++,

     dt = Data Table(OldNames[i]);

     dt &amp;lt;&amp;lt; Set Name(NewNames[i])

);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jan 2022 08:37:06 GMT</pubDate>
    <dc:creator>HadleyMyers</dc:creator>
    <dc:date>2022-01-05T08:37:06Z</dc:date>
    <item>
      <title>Data Table evaluation in For Loop from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449067#M69584</link>
      <description>&lt;P&gt;I keep running into an error with my script to rename data tables using a For loop.&lt;BR /&gt;&lt;BR /&gt;Here's a simplified version of my script&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;OldNames = {"Old Name 1", "Old Name 2", "Old Name 3"};
NewNames = {"New Name 1", "New Name 2", "New Name 3"};

For( i, i &amp;lt;= NNames, i++,
    dt = Data Table( OldNames[i] );
    dt &amp;lt;&amp;lt; Set Name( NewNames[i] );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I keep getting the following error&lt;BR /&gt;&lt;BR /&gt;Cannot locate data table in access or evaluation of 'Data Table' , Data Table/*###*/( OldNames[i] )&lt;BR /&gt;&lt;BR /&gt;However when I evaluate Data Table(OldNames[1]) there is no error!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:42:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449067#M69584</guid>
      <dc:creator>user8421</dc:creator>
      <dc:date>2023-06-10T23:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Data Table evaluation in For Loop from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449107#M69586</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I changed the first two arguments of the For loop accordingly.&amp;nbsp; It should work now:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;OldNames = {"Old Name 1", "Old Name 2", "Old Name 3"};
NewNames = {"New Name 1", "New Name 2", "New Name 3"};

For(
     i=1,

     i &amp;lt;= NItems(NewNames),

     i++,

     dt = Data Table(OldNames[i]);

     dt &amp;lt;&amp;lt; Set Name(NewNames[i])

);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 08:37:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449107#M69586</guid>
      <dc:creator>HadleyMyers</dc:creator>
      <dc:date>2022-01-05T08:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Data Table evaluation in For Loop from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449108#M69587</link>
      <description>&lt;P&gt;You seem to be missing at least definition for i (i = 1), also I'm not sure what NNames is.&lt;/P&gt;&lt;P&gt;This should be working example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt = Open("$SAMPLE_DATA/Quality Control/Failures3Delimited.jmp");
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

OldNames = {"Big Class", "Failures3Delimited", "Semiconductor Capability"};
NewNames = {"New Name 1", "New Name 2", "New Name 3"};

For(i = 1, i &amp;lt;= N Items(OldNames), i++,
	dt = Data Table(OldNames[i]);
	dt &amp;lt;&amp;lt; Set Name(NewNames[i])
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Jan 2022 08:37:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449108#M69587</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-01-05T08:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Data Table evaluation in For Loop from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449301#M69606</link>
      <description>&lt;P&gt;Sorry I realized I did miss the parts of my script while I was simplifying.&lt;BR /&gt;&lt;BR /&gt;NNames = NItems(NewNames);&lt;BR /&gt;&amp;nbsp;and i=1 for the first argument in the For loop.&lt;BR /&gt;&lt;BR /&gt;Even with both of those defined correctly in my script I still get the same error message&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 22:19:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449301#M69606</guid>
      <dc:creator>user8421</dc:creator>
      <dc:date>2022-01-05T22:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Data Table evaluation in For Loop from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449617#M69652</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/17028"&gt;@user8421&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Did you successfully run&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;'s script?&amp;nbsp; If yes, then I suspect:&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;one or more of the tables are closed&lt;/LI&gt;
&lt;LI&gt;one or more of the tables are private&lt;/LI&gt;
&lt;LI&gt;wrong old names.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Below is a slight modification to&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;'s script. I make the 3rd table private, and I add show statements to the For loop.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt = Open("$SAMPLE_DATA/Quality Control/Failures3Delimited.jmp");
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp", "Private");
OldNames = {"Big Class", "Failures3Delimited", "Semiconductor Capability"};
NewNames = {"New Name 1", "New Name 2", "New Name 3"};


For(i = 1, i &amp;lt;= N Items(OldNames), i++,
    show(i, OldNames[i], NewNames[i]);
	dt = Data Table(OldNames[i]);
	dt &amp;lt;&amp;lt; Set Name(NewNames[i]);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the log output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*:

i = 1;
OldNames[i] = "Big Class";
NewNames[i] = "New Name 1";
i = 2;
OldNames[i] = "Failures3Delimited";
NewNames[i] = "New Name 2";
i = 3;
OldNames[i] = "Semiconductor Capability";
NewNames[i] = "New Name 3";
Cannot locate data table in access or evaluation of 'Data Table' , Data Table/*###*/(OldNames[i])

at line 11 in Script.jsl&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The JMP Scripting Guide states for private table that&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Private tables are not counted when N Table() returns the number of open data tables.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Private tables cannot be made current with Current Data Table().&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This made me think that a private table might not have the same functionality, might not have teh names stored in memory since it is not counted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 06:42:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/449617#M69652</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2022-01-07T06:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Data Table evaluation in For Loop from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/452650#M69933</link>
      <description>&lt;P&gt;Thanks a bunch.&amp;nbsp; It was an issue with one of the table names and one tables being a private table.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 04:00:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-Table-evaluation-in-For-Loop-from-a-list/m-p/452650#M69933</guid>
      <dc:creator>user8421</dc:creator>
      <dc:date>2022-01-20T04:00:11Z</dc:date>
    </item>
  </channel>
</rss>

