<?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: Try to rename multiple data tables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Try-to-rename-multiple-data-tables/m-p/672872#M86052</link>
    <description>&lt;P&gt;Depending also where are you running your script from, you might have not access to your project. Projects have their own namespace(s).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

project = New Project(
	Run Script(
		Open("$SAMPLE_DATA/Big Class.jmp");
		Open("$SAMPLE_DATA/Probe.jmp");
	)
);

For(i = 1, i &amp;lt;= N Table(), i++,
	collName = Data Table(i) &amp;lt;&amp;lt; Get Column Names;
	If(N Items(collName) == 2,
		Data Table(i) &amp;lt;&amp;lt; Set Name("Image"),
		Data Table(i) &amp;lt;&amp;lt; Set Name("Numerical data")
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;vs&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

project = New Project(
	Run Script(
		Names Default To Here(1);
		Open("$SAMPLE_DATA/Big Class.jmp");
		Open("$SAMPLE_DATA/Probe.jmp");
		For(i = 1, i &amp;lt;= N Table(), i++,
			collName = Data Table(i) &amp;lt;&amp;lt; Get Column Names;
			If(N Items(collName) == 5,
				Data Table(i) &amp;lt;&amp;lt; Set Name("Image"),
				Data Table(i) &amp;lt;&amp;lt; Set Name("Numerical data")
			);
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And if I run this from project (using JMP17) it does work for me&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1693465270072.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/56129iFBE82C02D2FF3D81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1693465270072.png" alt="jthi_0-1693465270072.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1693465287166.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/56130i7537BD43E3897F50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1693465287166.png" alt="jthi_1-1693465287166.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2023 07:01:45 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2023-08-31T07:01:45Z</dc:date>
    <item>
      <title>Try to rename multiple data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Try-to-rename-multiple-data-tables/m-p/672775#M86045</link>
      <description>&lt;P&gt;Hi friends,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to rename opened data tables in a project. I have two data tables, one has columns, the other one has 16 columns. I want to name the smaller data table as "Image" (this data contains lots of pictures) and the other one as "Numerical data".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code works - for the first time. After the code changed the data table names correctly, If I manually change the correct named datable to something else, and run the code again ( I want to test the robustness of the script), it will not work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions are welcome!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

For( i = 1, i &amp;lt;= N Table(), i++,
    collName = Data Table( i ) &amp;lt;&amp;lt; Get Column Names;
    If( N Items( collName ) == 2,
        Data Table( i ) &amp;lt;&amp;lt; Set Name( "Image" ),
        Data Table( i ) &amp;lt;&amp;lt; Set Name( "Numerical data" )
    );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 11:24:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Try-to-rename-multiple-data-tables/m-p/672775#M86045</guid>
      <dc:creator>DivisiveEagle45</dc:creator>
      <dc:date>2023-08-31T11:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Try to rename multiple data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Try-to-rename-multiple-data-tables/m-p/672791#M86047</link>
      <description>&lt;P&gt;Thoughts (I have not tried it)&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;what does it do? Anything in the log?&lt;/LI&gt;
&lt;LI&gt;print the names of the tables, before and after the change. What's in the log?&lt;/LI&gt;
&lt;LI&gt;Are the tables saved? Internal or external to the project?&lt;/LI&gt;
&lt;LI&gt;What JMP version? Projects improved a lot in 16 or 17 ... not sure exactly.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 00:08:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Try-to-rename-multiple-data-tables/m-p/672791#M86047</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-08-31T00:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Try to rename multiple data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Try-to-rename-multiple-data-tables/m-p/672872#M86052</link>
      <description>&lt;P&gt;Depending also where are you running your script from, you might have not access to your project. Projects have their own namespace(s).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

project = New Project(
	Run Script(
		Open("$SAMPLE_DATA/Big Class.jmp");
		Open("$SAMPLE_DATA/Probe.jmp");
	)
);

For(i = 1, i &amp;lt;= N Table(), i++,
	collName = Data Table(i) &amp;lt;&amp;lt; Get Column Names;
	If(N Items(collName) == 2,
		Data Table(i) &amp;lt;&amp;lt; Set Name("Image"),
		Data Table(i) &amp;lt;&amp;lt; Set Name("Numerical data")
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;vs&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

project = New Project(
	Run Script(
		Names Default To Here(1);
		Open("$SAMPLE_DATA/Big Class.jmp");
		Open("$SAMPLE_DATA/Probe.jmp");
		For(i = 1, i &amp;lt;= N Table(), i++,
			collName = Data Table(i) &amp;lt;&amp;lt; Get Column Names;
			If(N Items(collName) == 5,
				Data Table(i) &amp;lt;&amp;lt; Set Name("Image"),
				Data Table(i) &amp;lt;&amp;lt; Set Name("Numerical data")
			);
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And if I run this from project (using JMP17) it does work for me&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1693465270072.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/56129iFBE82C02D2FF3D81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1693465270072.png" alt="jthi_0-1693465270072.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1693465287166.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/56130i7537BD43E3897F50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1693465287166.png" alt="jthi_1-1693465287166.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 07:01:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Try-to-rename-multiple-data-tables/m-p/672872#M86052</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-08-31T07:01:45Z</dc:date>
    </item>
  </channel>
</rss>

