<?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: How to get names of the selected columns in string format in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534804#M75729</link>
    <description>&lt;P&gt;Add (String) to Get Selected Columns (not documented in scripting index... but help has "a bit more" documentation &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/data-tables-2.shtml?os=win&amp;amp;source=application#ww2109986" target="_blank" rel="noopener"&gt;dt&amp;lt;&amp;lt;Get Selected Properties(&amp;lt;{list of properties}&amp;gt;)&lt;/A&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");
dt &amp;lt;&amp;lt; Select Columns({:sex, :height});

sel_colnames = dt &amp;lt;&amp;lt; Get Selected Columns(string); 
show(sel_colnames); // sel_colnames = {"sex", "height"};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2022 18:56:22 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-08-17T18:56:22Z</dc:date>
    <item>
      <title>How to get names of the selected columns in string format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534792#M75727</link>
      <description>&lt;P&gt;In my script I use the following to get the list of all columns in a string format:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;columnNames = dt &amp;lt;&amp;lt; Get Column Names( string );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need that so I could iterate through them using "For Each" loop:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each( {columnName, index}, columnNames, Column( dt, columnName ) &amp;lt;&amp;lt; Set Name( columnName ||"SomethingHere" ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now I need to only get selected columns and run the same loop on them.&lt;/P&gt;&lt;P&gt;I know only one way to get selected columns:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;columnNames = dt &amp;lt;&amp;lt; Get Selected Columns;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but it returns references to columns, not string names. So when I run this then:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each( {columnName, index}, columnNames, Column( dt, columnName ) &amp;lt;&amp;lt; Set Name( columnName ||"SomethingHere" ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it doesn't work.&lt;/P&gt;&lt;P&gt;How do I either&lt;/P&gt;&lt;P&gt;1. Rewrite For Each loop (I'd like to keep using this loop instead of For loop) to accept references to columns as well&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;2. Convert references to columns into a list of strings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:07:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534792#M75727</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-06-09T17:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get names of the selected columns in string format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534800#M75728</link>
      <description>&lt;P&gt;Ok, I solved it the following way.&lt;/P&gt;&lt;P&gt;Before running my already scripted "For Each" loop that I doin't want to change, I run this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each( {columnName, index}, columnNames, columnNames[index] = columnNames[index]&amp;lt;&amp;lt; Get Name );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any other options?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 18:55:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534800#M75728</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2022-08-17T18:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get names of the selected columns in string format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534804#M75729</link>
      <description>&lt;P&gt;Add (String) to Get Selected Columns (not documented in scripting index... but help has "a bit more" documentation &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/data-tables-2.shtml?os=win&amp;amp;source=application#ww2109986" target="_blank" rel="noopener"&gt;dt&amp;lt;&amp;lt;Get Selected Properties(&amp;lt;{list of properties}&amp;gt;)&lt;/A&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");
dt &amp;lt;&amp;lt; Select Columns({:sex, :height});

sel_colnames = dt &amp;lt;&amp;lt; Get Selected Columns(string); 
show(sel_colnames); // sel_colnames = {"sex", "height"};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 18:56:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534804#M75729</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-08-17T18:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get names of the selected columns in string format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534813#M75730</link>
      <description>&lt;P&gt;Awesome! **bleep** under-documentation :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 19:02:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534813#M75730</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2022-08-17T19:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to get names of the selected columns in string format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534824#M75731</link>
      <description>&lt;P&gt;Would be good to report. I just don't remember who was supposed to be tagged when Scripting Index was lacking so for now lets tag &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt;&amp;nbsp;and&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14379"&gt;@Ryan_Gilmore&lt;/a&gt; , &amp;lt;&amp;lt; Get Selected Columns is missing optional option parameters in Scripting Index.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 19:08:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/534824#M75731</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-08-17T19:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get names of the selected columns in string format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/535225#M75758</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2581"&gt;@miguello&lt;/a&gt;, &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp; - JMP Technical Support will make the request to update the Scripting Index. Thank you for sharing!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 15:27:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-names-of-the-selected-columns-in-string-format/m-p/535225#M75758</guid>
      <dc:creator>Duane_Hayes</dc:creator>
      <dc:date>2022-08-18T15:27:27Z</dc:date>
    </item>
  </channel>
</rss>

