<?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: Table Functions - Multiple tables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62303#M33580</link>
    <description>&lt;P&gt;If I am correctly interpreting your issue, I believe that you are not quite getting&amp;nbsp;how the variables that are pointing to the data tables are working, and how to use them.&amp;nbsp; I have put together a very simple script, that creates 3 different data tables.&amp;nbsp; It then goes on and produces an analysis on each of the different data tables, in an order that is different than the order they were created.&amp;nbsp; I used the data table pointer variables to accomplish this.&amp;nbsp; I then have also included a comment section illustrating how to accomplish this same order of output if you choose to reset the current data table, before running the analysis.&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 where( :sex == "F" );

dtFemale = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );

dt &amp;lt;&amp;lt; invert row selection;

dtMale = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );

dtFemale &amp;lt;&amp;lt; Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);
dtMale &amp;lt;&amp;lt; Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);
dt &amp;lt;&amp;lt; Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);

// Or

/*current data table( dtFemale );
Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);
current data table( dtMale );
Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);
current data table( dt );
Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 08 Jul 2018 17:20:13 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-07-08T17:20:13Z</dc:date>
    <item>
      <title>Table Functions - Multiple tables</title>
      <link>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62301#M33578</link>
      <description>&lt;P&gt;I have two problems with I guess JMP assigns tables and uses them later. Steps 2 and 3 will be in separate scripts being called in using the &lt;CODE&gt;Include()&lt;/CODE&gt; function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Step 1: Pull in data from server and assign it to dt_testdata_ss&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt_testdata_ss = Open Database( &amp;lt;server string&amp;gt;, &amp;lt;query string&amp;gt; , "dt_testdata_ss" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Step 2: creates new table with conditions&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt_testdata_ss_tx = dt_testdata_ss 
    &amp;lt;&amp;lt; select where ( (:col_1 == 24) &amp;amp; (:col_2 == 1)) 
    &amp;lt;&amp;lt; subset( output table name("dt_testdata_ss_tx"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Step 2a: uses dt_testdata_ss_tx in graphplot.jsl&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Step 2b: uses dt_testdata_ss_tx in distribution.jsl&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Step 3: creates new table with conditions&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt_testdata_ss_rx = dt_testdata_ss 
    &amp;lt;&amp;lt; select where ((:col_1 == 16) &amp;amp; (:col_2==&amp;nbsp;3 )) 
    &amp;lt;&amp;lt; subset( output table name( "dt_testdata_ss_rx"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Step 3a: uses dt_testdata_ss_rx in graphplot.jsl&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Step 3b: uses dt_testdata_ss_rx in distribution.jsl&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I now have 3 tables open at the same time and i can't call in the correct table to the script that you provided. I even went as far as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt_testdata_ss
dt_testdata_ss_tx
dt_testdata_ss_rx&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When i run your script i am getting the following error when i run it with changing &lt;CODE&gt;dt&lt;/CODE&gt; to &lt;CODE&gt;dt_testdata_tx&lt;/CODE&gt; or &lt;CODE&gt;dt_testdata_rx&lt;/CODE&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;ERROR: invalid argument in access or evaluation of 'Close' , Close *###*/(dtSum, nosave)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can only assume that dt is not being assigned to dt_testdata_tx or dt_testdata_rx because the table doesn't execute. I can't figure out how to call in a&amp;nbsp;certain table to manipulate if all 3 are open. Suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table(); // removed this line
dtsum = dt // changed dt to either dt_testdata_ss_tx or dt_testdata_ss_rx
dtFinal = dt // changed dt to either dt_testdata_ss_tx or dt_testdata_ss_rx&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:25:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62301#M33578</guid>
      <dc:creator>Yngeinstn</dc:creator>
      <dc:date>2023-06-09T23:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Table Functions - Multiple tables</title>
      <link>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62303#M33580</link>
      <description>&lt;P&gt;If I am correctly interpreting your issue, I believe that you are not quite getting&amp;nbsp;how the variables that are pointing to the data tables are working, and how to use them.&amp;nbsp; I have put together a very simple script, that creates 3 different data tables.&amp;nbsp; It then goes on and produces an analysis on each of the different data tables, in an order that is different than the order they were created.&amp;nbsp; I used the data table pointer variables to accomplish this.&amp;nbsp; I then have also included a comment section illustrating how to accomplish this same order of output if you choose to reset the current data table, before running the analysis.&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 where( :sex == "F" );

dtFemale = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );

dt &amp;lt;&amp;lt; invert row selection;

dtMale = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );

dtFemale &amp;lt;&amp;lt; Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);
dtMale &amp;lt;&amp;lt; Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);
dt &amp;lt;&amp;lt; Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);

// Or

/*current data table( dtFemale );
Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);
current data table( dtMale );
Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);
current data table( dt );
Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 )
);*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 08 Jul 2018 17:20:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62303#M33580</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-07-08T17:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Table Functions - Multiple tables</title>
      <link>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62304#M33581</link>
      <description>&lt;P&gt;You're pretty close.&amp;nbsp; For the subset command there's no need to name the table.&amp;nbsp; Simply assigning it to a variable is enough.&amp;nbsp; But you should specify how you want the subset to work with &lt;STRONG&gt;selected rows(1), selected columns(0)&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure why &lt;STRONG&gt;close(dtsum, nosave)&lt;/STRONG&gt; is not working, provided that you assigned dtsum = (one of the table variables).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding &lt;STRONG&gt;dt = current data table()&lt;/STRONG&gt; - I wouldn't use this because you have three tables open, and which table is current might not be clear.&amp;nbsp; Better to just use your existing table variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Step 1: Pull in data from server and assign it to dt_testdata_ss
dt_testdata_ss = Open Database( &amp;lt;server string&amp;gt;, &amp;lt;query string&amp;gt; , "dt_testdata_ss" );

// Step 2: creates new table with conditions
dt_testdata_ss_tx = dt_testdata_ss &amp;lt;&amp;lt; select where ( (:col_1 == 24) &amp;amp; (:col_2 == 1 )) 
	&amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ));
// Step 2a: uses dt_testdata_ss_tx in graphplot.jsl
// Step 2b: uses dt_testdata_ss_tx in distribution.jsl

// Step 3: creates new table with conditions
dt_testdata_ss &amp;lt;&amp;lt; clear row states;	// Remove prior selec
dt_testdata_ss_rx = dt_testdata_ss &amp;lt;&amp;lt; select where ( (:col_1 == 16) &amp;amp; (:col_2 == 3 ))
	&amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ));
// Step 3a: uses dt_testdata_ss_rx in graphplot.jsl
// Step 3b: uses dt_testdata_ss_rx in distribution.jsl&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 08 Jul 2018 17:32:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62304#M33581</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-07-08T17:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Table Functions - Multiple tables</title>
      <link>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62305#M33582</link>
      <description>&lt;P&gt;I think it had to be how the tables/variables were being assigned. It's the simple things that cause the most problems..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A calculus problem what is wrong because of a simple math error.. Thank you very much for the explination..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jul 2018 18:16:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62305#M33582</guid>
      <dc:creator>Yngeinstn</dc:creator>
      <dc:date>2018-07-08T18:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Table Functions - Multiple tables</title>
      <link>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62378#M33628</link>
      <description>&lt;P&gt;This works great thank you.. I actually found a slight problem with my script that wouldn't allow me to change tables..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now my issue is that i have 4 open tables and they will be used individually in an Include() script.. I can't figure out how to select the data table in the new script.. It seems that the variables are not being passed through to the new script..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have 4 table names does this Names To Default Here(1); store it just on the data table variables in that script that originated them? I have tried Names To Default Here(0); which i thought assigned it globally...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 16:49:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62378#M33628</guid>
      <dc:creator>Yngeinstn</dc:creator>
      <dc:date>2018-07-09T16:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Table Functions - Multiple tables</title>
      <link>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62379#M33629</link>
      <description>&lt;P&gt;Names default to here(1) makes all variables local.&amp;nbsp; If you want to have all variables be global then leave this line out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise you could pass them using global variables.&amp;nbsp; A global variable in JSL starts with two colons "::".&amp;nbsp; I add g_ to denote that this is a global variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;::g_dt_testdata_ss_tx = foo bar ...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jul 2018 16:55:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Table-Functions-Multiple-tables/m-p/62379#M33629</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-07-09T16:55:00Z</dc:date>
    </item>
  </channel>
</rss>

