<?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: Script to Change Column Names Using Column Properties in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263003#M51428</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/12073"&gt;@ShahirahLoqman&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See script below.&amp;nbsp; The syntax is &lt;STRONG&gt;Get Property( "name" )&lt;/STRONG&gt;&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 = New Table( "TestIt",
	Add Rows( 5 ),
	New Column( "A",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Description", "A description" ),
		Set Values( [1, 2, 3, 4, 5] )
	),
	New Column( "B",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Description", "Heck if I know" ),
		Set Values( [275, 300, 295, 280, 385] )
	)
);

For(i=1, i&amp;lt;=ncol(dt), i++,
  _xx = column(dt,i) &amp;lt;&amp;lt; get property("Description");
  show(_xx);
  if( IsString(_xx), column(dt,i) &amp;lt;&amp;lt; set name(_xx) );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 01 May 2020 01:41:10 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2020-05-01T01:41:10Z</dc:date>
    <item>
      <title>Script to Change Column Names Using Column Properties</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/262971#M51420</link>
      <description>&lt;P&gt;Hi, I am trying to script for my column names to be replaced with a specific column property called "Description". How do I extract whatever is stored under description and use that as my new column name?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="col properties.JPG" style="width: 537px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/23635iD83C925DD50DEA2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="col properties.JPG" alt="col properties.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried running my own script but it didn't really work out&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
For( i = i, i &amp;lt;= N Cols( dt ), i++, 
 newname = (Column( dt, i ) &amp;lt;&amp;lt; Get Column Properties("Description"));
Column( dt, i ) &amp;lt;&amp;lt; Set Name(newname);
);


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Appreciate the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 21:38:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/262971#M51420</guid>
      <dc:creator>ShahirahLoqman</dc:creator>
      <dc:date>2020-04-30T21:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Change Column Names Using Column Properties</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263003#M51428</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/12073"&gt;@ShahirahLoqman&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See script below.&amp;nbsp; The syntax is &lt;STRONG&gt;Get Property( "name" )&lt;/STRONG&gt;&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 = New Table( "TestIt",
	Add Rows( 5 ),
	New Column( "A",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Description", "A description" ),
		Set Values( [1, 2, 3, 4, 5] )
	),
	New Column( "B",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Description", "Heck if I know" ),
		Set Values( [275, 300, 295, 280, 385] )
	)
);

For(i=1, i&amp;lt;=ncol(dt), i++,
  _xx = column(dt,i) &amp;lt;&amp;lt; get property("Description");
  show(_xx);
  if( IsString(_xx), column(dt,i) &amp;lt;&amp;lt; set name(_xx) );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 May 2020 01:41:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263003#M51428</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2020-05-01T01:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Change Column Names Using Column Properties</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263005#M51429</link>
      <description>&lt;P&gt;Great attempt......close but just a few, mainly syntax issues.&amp;nbsp; You need to start looking up examples of the functions you are attempting to use, in the Scripting Index.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Isolate the code to only impacting this script
// and not all scripts
Names Default To Here( 1 );
dt = Current Data Table();
// i=1 rather than i=i
For( i = 1, i &amp;lt;= N Cols( dt ), i++, 
	// Get Properties rather than Get Column Properties
	newname = Column( dt, i ) &amp;lt;&amp;lt; Get Properties( "Description" );
	// If there isn't a Description Column Property you do not 
	// want to change the column name
	If( Is String( newname ),
		Column( dt, i ) &amp;lt;&amp;lt; Set Name( newname )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 May 2020 01:43:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263005#M51429</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-01T01:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Change Column Names Using Column Properties</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263136#M51440</link>
      <description>&lt;P&gt;Thanks Jim! Unfortunately it's still not working even with the tweaks you suggested. I am not sure if it is my file. I tried using the Debug Script option but it crashed on me. I tried it on both JMP 14.1 and 15.0 and both could not execute the Debug Script.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 14:32:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263136#M51440</guid>
      <dc:creator>ShahirahLoqman</dc:creator>
      <dc:date>2020-05-01T14:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Change Column Names Using Column Properties</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263150#M51442</link>
      <description>Can you upload your data table, and I will look into the issue further</description>
      <pubDate>Fri, 01 May 2020 14:43:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263150#M51442</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-01T14:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Change Column Names Using Column Properties</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263172#M51446</link>
      <description>&lt;P&gt;Jim, I don't think I can upload as it is proprietary company data with 170k rows of&amp;nbsp;information. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any suggestions on what I should check in my data table?&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 15:05:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263172#M51446</guid>
      <dc:creator>ShahirahLoqman</dc:creator>
      <dc:date>2020-05-01T15:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Change Column Names Using Column Properties</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263175#M51447</link>
      <description>&lt;P&gt;You should be able to upload the data table, if you delete all of the rows of data.&amp;nbsp; What you need done does not require any rows of data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even without using the debugger, you can step through lines of code.&amp;nbsp; Just put a&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;throw();&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;in your code to stop execution at the point where you are having an issue.&amp;nbsp; You can the highlight statement by statement and run each individual line.&amp;nbsp; The by hovering over the variables of interest, you can see what values they have.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 15:15:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263175#M51447</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-01T15:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Change Column Names Using Column Properties</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263262#M51456</link>
      <description>Jim, the script works now! just had to tweak Get Properties to Get Property. thanks so much :)&lt;/img&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 May 2020 16:42:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Change-Column-Names-Using-Column-Properties/m-p/263262#M51456</guid>
      <dc:creator>ShahirahLoqman</dc:creator>
      <dc:date>2020-05-01T16:42:21Z</dc:date>
    </item>
  </channel>
</rss>

