<?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: JSL: How to get retrieve names of more than one currently selected tables? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-How-to-get-retrieve-names-of-more-than-one-currently/m-p/42050#M24520</link>
    <description>&lt;P&gt;Of course there is only one 'current' table in a JMP session. But you could do something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

// Make some tables with different numbers of columns
n = 5;
for(t=1, t&amp;lt;=n, t++, NewTable("Table "||Char(t), &amp;lt;&amp;lt; addMultipleColumns("Test", Random Integer(5), Character)));

// Function that returns the names of all open tables containing a specified column
tablesWithColumn =
Function({inCol}, {Default Local},
	matchingTables = {};
	for(t=1, t&amp;lt;=NTable(), t++,
		cols = DataTable(t) &amp;lt;&amp;lt; getColumnNames("String");
		if(Contains(cols, inCol), InsertInto(matchingTables, DataTable(t) &amp;lt;&amp;lt; getName));
	);
	matchingTables;
	);

// Try it out
myCol = "Test 3";
NewWindow("Open Tables with Column "||myCol, 
	PanelBox("Pick Tables to Join", 
		lb = ListBox(tablesWithColumn(myCol), maxSelected(2));		
		)
	);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Jul 2017 10:50:37 GMT</pubDate>
    <dc:creator>ian_jmp</dc:creator>
    <dc:date>2017-07-17T10:50:37Z</dc:date>
    <item>
      <title>JSL: How to get retrieve names of more than one currently selected tables?</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-How-to-get-retrieve-names-of-more-than-one-currently/m-p/42047#M24518</link>
      <description>&lt;P&gt;Hi folks. I'm dealing with new tables every day (unique table names) which always have at least one common column header, which I use to &lt;EM&gt;Match Columns&lt;/EM&gt; for &lt;EM&gt;Join&lt;/EM&gt;. This is getting repetitive so I've been thinking of writing a script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem: I don't want to have to specify both the table names in the script every time I want to &lt;EM&gt;Join&lt;/EM&gt; two tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for a method for the script to auto/semi-automatically pick the two tables I want to join. I know there is a method to retrieve the Currently Selected table, but what about the table Selected Before That? Best case is if there is a method to retrieve table names for &lt;U&gt;all&lt;/U&gt; tables currently selected and then proceed to do &lt;EM&gt;Join&lt;/EM&gt; for these tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate all ideas and advice! Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2017 03:09:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-How-to-get-retrieve-names-of-more-than-one-currently/m-p/42047#M24518</guid>
      <dc:creator>jmp13</dc:creator>
      <dc:date>2017-07-17T03:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: JSL: How to get retrieve names of more than one currently selected tables?</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-How-to-get-retrieve-names-of-more-than-one-currently/m-p/42050#M24520</link>
      <description>&lt;P&gt;Of course there is only one 'current' table in a JMP session. But you could do something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

// Make some tables with different numbers of columns
n = 5;
for(t=1, t&amp;lt;=n, t++, NewTable("Table "||Char(t), &amp;lt;&amp;lt; addMultipleColumns("Test", Random Integer(5), Character)));

// Function that returns the names of all open tables containing a specified column
tablesWithColumn =
Function({inCol}, {Default Local},
	matchingTables = {};
	for(t=1, t&amp;lt;=NTable(), t++,
		cols = DataTable(t) &amp;lt;&amp;lt; getColumnNames("String");
		if(Contains(cols, inCol), InsertInto(matchingTables, DataTable(t) &amp;lt;&amp;lt; getName));
	);
	matchingTables;
	);

// Try it out
myCol = "Test 3";
NewWindow("Open Tables with Column "||myCol, 
	PanelBox("Pick Tables to Join", 
		lb = ListBox(tablesWithColumn(myCol), maxSelected(2));		
		)
	);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jul 2017 10:50:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-How-to-get-retrieve-names-of-more-than-one-currently/m-p/42050#M24520</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2017-07-17T10:50:37Z</dc:date>
    </item>
  </channel>
</rss>

