<?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 Rename column name based on value from xth rows in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Rename-column-name-based-on-value-from-xth-rows/m-p/6295#M6294</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to use jsl to rename the column name of a datatable using rows value from row that met predefined criteria.&lt;/P&gt;&lt;P&gt;My script is as followed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; dt = Open();&lt;BR /&gt;&amp;nbsp; Current Data Table() &amp;lt;&amp;lt; set name( "ABC" );&lt;BR /&gt;&amp;nbsp; dt = Data Table( "ABC" );&lt;BR /&gt;&amp;nbsp; lastcol = N Col( dt );&lt;BR /&gt;&amp;nbsp; header=dt&amp;lt;&amp;lt;Get Rows Where (:(2)=="Colour"); // this is the criteria, i wanted to identify the row where the value in column2 is "Colour"&lt;BR /&gt;&amp;nbsp; For( i = 2, i &amp;lt;= lastcol, i++,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Column( i ) &amp;lt;&amp;lt; set Name( Column( i )[header] )&lt;BR /&gt;&amp;nbsp; );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unfortunately this method doesnt work. Can anyone please guide or share me what's wrong with the script and how can i achieve what i want? Thanks a lot! &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.jmp.com/5.0.2/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Feb 2013 10:20:38 GMT</pubDate>
    <dc:creator>novicepg</dc:creator>
    <dc:date>2013-02-17T10:20:38Z</dc:date>
    <item>
      <title>Rename column name based on value from xth rows</title>
      <link>https://community.jmp.com/t5/Discussions/Rename-column-name-based-on-value-from-xth-rows/m-p/6295#M6294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to use jsl to rename the column name of a datatable using rows value from row that met predefined criteria.&lt;/P&gt;&lt;P&gt;My script is as followed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; dt = Open();&lt;BR /&gt;&amp;nbsp; Current Data Table() &amp;lt;&amp;lt; set name( "ABC" );&lt;BR /&gt;&amp;nbsp; dt = Data Table( "ABC" );&lt;BR /&gt;&amp;nbsp; lastcol = N Col( dt );&lt;BR /&gt;&amp;nbsp; header=dt&amp;lt;&amp;lt;Get Rows Where (:(2)=="Colour"); // this is the criteria, i wanted to identify the row where the value in column2 is "Colour"&lt;BR /&gt;&amp;nbsp; For( i = 2, i &amp;lt;= lastcol, i++,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Column( i ) &amp;lt;&amp;lt; set Name( Column( i )[header] )&lt;BR /&gt;&amp;nbsp; );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unfortunately this method doesnt work. Can anyone please guide or share me what's wrong with the script and how can i achieve what i want? Thanks a lot! &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.jmp.com/5.0.2/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 10:20:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Rename-column-name-based-on-value-from-xth-rows/m-p/6295#M6294</guid>
      <dc:creator>novicepg</dc:creator>
      <dc:date>2013-02-17T10:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rename column name based on value from xth rows</title>
      <link>https://community.jmp.com/t5/Discussions/Rename-column-name-based-on-value-from-xth-rows/m-p/6296#M6295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &amp;lt;&amp;lt;Get rows where() returns a matrix. If there is only one instance of "Colour" the matrix will have a single number. You need to extract that number of the matrix header before using it as an index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are two examples that both should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #009800;"&gt;&lt;SPAN style="color: #000000;"&gt;header&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;dt&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;Get Rows Where&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;==&lt;/SPAN&gt;&lt;SPAN style="color: #a70096;"&gt;"Colour"&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;))[&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;// header is a number&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &lt;SPAN style="color: #2600eb;"&gt;For&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; i &lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; i &lt;SPAN style="color: #150097;"&gt;&amp;lt;=&lt;/SPAN&gt; lastcol&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; i&lt;SPAN style="color: #150097;"&gt;++,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #2600eb;"&gt;Column&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; i &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;SPAN style="color: #150097;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; set Name&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #2600eb;"&gt;Column&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;i&lt;STRONG&gt;)[&lt;/STRONG&gt;header&lt;STRONG&gt;]&lt;/STRONG&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #009800;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; header&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;dt&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;Get Rows Where&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;==&lt;/SPAN&gt;&lt;SPAN style="color: #a70096;"&gt;"Colour"&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;// header is a 1x1 matrix&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &lt;SPAN style="color: #2600eb;"&gt;For&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; i &lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; i &lt;SPAN style="color: #150097;"&gt;&amp;lt;=&lt;/SPAN&gt; lastcol&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; i&lt;SPAN style="color: #150097;"&gt;++,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #009800;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #2600eb;"&gt;Column&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; i &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; set Name&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #2600eb;"&gt;Column&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;i&lt;STRONG&gt;)[&lt;/STRONG&gt;header&lt;STRONG&gt;[&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;]]&lt;/STRONG&gt; &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;/SPAN&gt;// exctract the (first) number of the matrix header&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 21:19:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Rename-column-name-based-on-value-from-xth-rows/m-p/6296#M6295</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2013-02-17T21:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Rename column name based on value from xth rows</title>
      <link>https://community.jmp.com/t5/Discussions/Rename-column-name-based-on-value-from-xth-rows/m-p/6297#M6296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you MS! This works!&lt;/P&gt;&lt;P&gt;By the way, how do i mark this as "solved" or "answered"?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 00:46:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Rename-column-name-based-on-value-from-xth-rows/m-p/6297#M6296</guid>
      <dc:creator>novicepg</dc:creator>
      <dc:date>2013-02-18T00:46:26Z</dc:date>
    </item>
  </channel>
</rss>

