<?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: Combining data tables if number of opened tables varies in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Combining-data-tables-if-number-of-opened-tables-varies/m-p/526120#M75037</link>
    <description>&lt;P&gt;This should do what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;theExpr = "Data Table( \!"EachChem\!") &amp;lt;&amp;lt; Concatenate(";
For( i = 2, i &amp;lt;= N Items( lt ), i++,
	theExpr = theExpr || " Data Table( \!"EachChem " || Char( i ) || "\!"),"
);
theExpr = theExpr || "Output Table( \!"Combined Table\!" ) );";

Eval( Parse( theExpr ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 25 Jul 2022 22:33:51 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-07-25T22:33:51Z</dc:date>
    <item>
      <title>Combining data tables if number of opened tables varies</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-data-tables-if-number-of-opened-tables-varies/m-p/526108#M75036</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a script that gets items chosen by the user from a list box. Based on the number of items selected by the user, a number of tables pop up. The number of new data tables is variable and I would like to combine them all into one larger table called Combined Table. I know the concatenate function does this, but I would like to have it scripted to accommodate a user specified number of tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From this piece of code, a number of new tables pop up named EachChem, EachChem 2, EachChem 3...ectc. I would like to combine those into a larger table called Combined Table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For (i = 1, i &amp;lt;= N Items(lt), i++,	  
	   
	    dt &amp;lt;&amp;lt; Select Where( :chemical == lt[i] );
	    dt &amp;lt;&amp;lt; Get selected rows
	    dt &amp;lt;&amp;lt; Subset(Output Table("EachChem"), Selected Rows(i));
    );
      &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternative, if I could combined the tables within the above for loop, and end up with one large subset table called EachChem, that would be good too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or pointers is appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:51:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-data-tables-if-number-of-opened-tables-varies/m-p/526108#M75036</guid>
      <dc:creator>JMPnoob</dc:creator>
      <dc:date>2023-06-10T23:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data tables if number of opened tables varies</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-data-tables-if-number-of-opened-tables-varies/m-p/526120#M75037</link>
      <description>&lt;P&gt;This should do what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;theExpr = "Data Table( \!"EachChem\!") &amp;lt;&amp;lt; Concatenate(";
For( i = 2, i &amp;lt;= N Items( lt ), i++,
	theExpr = theExpr || " Data Table( \!"EachChem " || Char( i ) || "\!"),"
);
theExpr = theExpr || "Output Table( \!"Combined Table\!" ) );";

Eval( Parse( theExpr ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jul 2022 22:33:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-data-tables-if-number-of-opened-tables-varies/m-p/526120#M75037</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-07-25T22:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data tables if number of opened tables varies</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-data-tables-if-number-of-opened-tables-varies/m-p/672395#M86010</link>
      <description>&lt;P&gt;Thanks. This worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the names of the tables to be concatenated also changes, the following should work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;theExpr = " Data Table( \!"" || MaskList[1] || " " || Char( 2 ) || "\!") &amp;lt;&amp;lt; Concatenate(";
For( i = 2, i &amp;lt;= N Items(MaskList), i++,
	theExpr = theExpr || " Data Table( \!"" || MaskList[i] || " " || Char( 2 ) || "\!"),"
);
theExpr = theExpr || "Output Table( \!"Final Table\!" ) );";
Eval( Parse( theExpr ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In the code above,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MaskList is a list that holds a variable number of masks depending on the user. There are tables associated with each mask in MaskList.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the first table is called Mask1&amp;nbsp;&lt;STRONG&gt;2&lt;/STRONG&gt;, (the second table with the name called Mask1, hence the extra &lt;STRONG&gt;2&lt;/STRONG&gt;) the next table to be concatenated is called Mask9 &lt;STRONG&gt;2&lt;/STRONG&gt;.&amp;nbsp;(the second table with the name called Mask9, hence the extra &lt;STRONG&gt;2&lt;/STRONG&gt;) and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will concatenate, Mask1&amp;nbsp;&lt;STRONG&gt;2&lt;/STRONG&gt; with Mask9 &lt;STRONG&gt;2&amp;nbsp;&lt;/STRONG&gt;and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just putting this here for documentation purposes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 23:40:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-data-tables-if-number-of-opened-tables-varies/m-p/672395#M86010</guid>
      <dc:creator>JMPnoob</dc:creator>
      <dc:date>2023-08-29T23:40:12Z</dc:date>
    </item>
  </channel>
</rss>

