<?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: Get Column Names from List of Columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/430951#M68066</link>
    <description>&lt;P&gt;Here's an easy task you can help me with - once I "get column names", how can I then insert them into a data table which is just that selfsame list of column names?&amp;nbsp; &amp;nbsp;THANKS&amp;nbsp; Devin&lt;/P&gt;</description>
    <pubDate>Thu, 28 Oct 2021 06:15:32 GMT</pubDate>
    <dc:creator>Devin</dc:creator>
    <dc:date>2021-10-28T06:15:32Z</dc:date>
    <item>
      <title>Get Column Names from List of Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238697#M47167</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);
dt = Current Data Table();

column list = dt &amp;lt;&amp;lt; Get Column Names(Continuous);
key list = dt &amp;lt;&amp;lt; Get Column Group("KEYS");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;"column list" contains a &lt;STRONG&gt;list of names&lt;/STRONG&gt; from columns containing continuous data.&lt;/P&gt;&lt;P&gt;"key list" contains a &lt;STRONG&gt;list of columns&lt;/STRONG&gt; in the "KEYS" group.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get the names of the columns from "key list"? Ultimately I would like to remove any continuous column names from the "column list" that are in the "KEYS" group. I found a post from Craige Hales to manage the lists, but I need to get them in the same format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 19:02:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238697#M47167</guid>
      <dc:creator>MarkDayton</dc:creator>
      <dc:date>2019-12-16T19:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Get Column Names from List of Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238721#M47170</link>
      <description>&lt;P&gt;What is returned from both the &amp;lt;&amp;lt; Get Column Names, and &amp;lt;&amp;lt; Get Column Group are JMP lists.&amp;nbsp; You can roughly think of them as Arrays of values.&amp;nbsp; Please review the Scripting Guides section on using lists.&lt;/P&gt;
&lt;P&gt;Below is a modification of your code, that will check for the comparison between 2 lists, for column names found common in both lists and then removing them from the Key List, list.&amp;nbsp; Please note, that the Contains function requires literal strings for it to function, so that is why the &amp;lt;&amp;lt;get column names has the "string" option added to it, and that the Contains() function has the search element from the Keys List, converted to a character string before the search across the Column Names list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

column list = dt &amp;lt;&amp;lt; Get Column Names( Continuous, string );
key list = dt &amp;lt;&amp;lt; Get Column Group( "Processes" );
Show( "complete list", key list );

For( i = N Items( key list ), i &amp;gt;= 1, i--,
	If( Contains( column list, Char( key list[i] ) ),
		key list = Remove( key list, i, 1 )
	)
);
Show( "final list", key list );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In my example, the Keys List ends up not having any values, since all elements in the group are numeric columns&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 22:58:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238721#M47170</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-12-16T22:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get Column Names from List of Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238836#M47192</link>
      <description>Thanks. I am looking to remove from "column list" any name that is in the "Processes" group (using your example), so items need to be removed from "column list", not "key list". I expect that I will need to search column list for Char(key list[i]) and if found remove it.</description>
      <pubDate>Tue, 17 Dec 2019 20:36:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238836#M47192</guid>
      <dc:creator>MarkDayton</dc:creator>
      <dc:date>2019-12-17T20:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get Column Names from List of Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238851#M47196</link>
      <description>&lt;P&gt;Here is the solution I arrived at after converting the key list to strings as suggested:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Initialize
Names Default to Here(1);
dt = Current Data Table();
key list names  = {};

// Get a list of all continuous columns
column list = dt &amp;lt;&amp;lt; Get Column Names(Continuous, String);

// Create a list of column names in the KEYS group
key list = dt &amp;lt;&amp;lt; Get Column Group("KEYS");
For(i = 1, i &amp;lt;= N Items(key list), i++,
	Insert Into(key list names, Char(key list[i]))
); 

// Remove from the column list any column that is in the KEYS group
/* &lt;BR /&gt;Adapted from - Re: Quick way to compare two lists (uncommon elements)?
JAN 10, 2017 6:41 AM, by Craige_Hales, STAFF (RETIRED)
*/
set1 = Associative Array(column list);
set2 = Associative Array(key list names);

// Find the names common to both lists
intersection = set1;
intersection &amp;lt;&amp;lt; Intersect(set2); 

// Remove the common names
cleaned list = set1; 
cleaned list &amp;lt;&amp;lt; Remove(intersection);
column list = cleaned list &amp;lt;&amp;lt; Get Keys;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Dec 2019 01:21:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238851#M47196</guid>
      <dc:creator>MarkDayton</dc:creator>
      <dc:date>2019-12-18T01:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get Column Names from List of Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238852#M47197</link>
      <description>The trick was: Char(key list[i]))&lt;BR /&gt;(I never thought of casting the column reference into a string)</description>
      <pubDate>Wed, 18 Dec 2019 01:24:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/238852#M47197</guid>
      <dc:creator>MarkDayton</dc:creator>
      <dc:date>2019-12-18T01:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Get Column Names from List of Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/392773#M64300</link>
      <description>Thanks for your note about contain requiring literal strings and the "get column names" not providing that with out the "string" option. I banged my head against this for a long time and adding "string" immediately fixed it.</description>
      <pubDate>Fri, 11 Jun 2021 18:44:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/392773#M64300</guid>
      <dc:creator>TomF</dc:creator>
      <dc:date>2021-06-11T18:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get Column Names from List of Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/392814#M64306</link>
      <description>&lt;P&gt;Please do not bang your head! Use &lt;STRONG&gt;Help &amp;gt; Scripting&lt;/STRONG&gt; &lt;STRONG&gt;Index&lt;/STRONG&gt; instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="get col names.PNG" style="width: 877px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/33490iDE8B94A5EBAB5FCC/image-size/large?v=v2&amp;amp;px=999" role="button" title="get col names.PNG" alt="get col names.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 20:32:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/392814#M64306</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2021-06-11T20:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get Column Names from List of Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/430951#M68066</link>
      <description>&lt;P&gt;Here's an easy task you can help me with - once I "get column names", how can I then insert them into a data table which is just that selfsame list of column names?&amp;nbsp; &amp;nbsp;THANKS&amp;nbsp; Devin&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 06:15:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-Column-Names-from-List-of-Columns/m-p/430951#M68066</guid>
      <dc:creator>Devin</dc:creator>
      <dc:date>2021-10-28T06:15:32Z</dc:date>
    </item>
  </channel>
</rss>

