<?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: Working with multiple queries simultaneously in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57405#M32119</link>
    <description>Congratulations!</description>
    <pubDate>Fri, 18 May 2018 22:30:53 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2018-05-18T22:30:53Z</dc:date>
    <item>
      <title>Working with multiple queries simultaneously</title>
      <link>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57021#M31983</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm attempting to work with two pre-built query builder queries simultaneously. I'd like to eventually be able to plot the data from one ontop of the other using graph builder, however the code below is throwing an access or evaluation error on dtGroup and dtTarget.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Group = Open("C:\Temp\Group$.jmpquery", Private );
Target = Open("C:\Temp\Target$.jmpquery", Private );

Group &amp;lt;&amp;lt; Run Background(
	On Run Complete(
		dtGroup = queryResult;
	)
);
Target &amp;lt;&amp;lt; Run Background(
	On Run Complete(
		dtTarget = queryResult;
	)
);

dtGroup &amp;lt;&amp;lt; New Column( "ExGroup",
	Numeric,
	"Ordinal", 
	Formula( :Data )
);

dtTarget &amp;lt;&amp;lt; New Column( "ExTarget",
	Numeric,
	"Ordinal", 
	Formula( :Data )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I've tried making the variables global&amp;nbsp; (global:dtGroup = queryResult;) but the same error occurs. Any idea how to use both? Is it a scope/namespace issue?&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>Sat, 10 Jun 2023 23:13:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57021#M31983</guid>
      <dc:creator>aserino</dc:creator>
      <dc:date>2023-06-10T23:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Working with multiple queries simultaneously</title>
      <link>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57024#M31985</link>
      <description>&lt;P&gt;I cannot see where you have defined query result.&amp;nbsp; Try the syntax in the attached script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Group = Open("C:\Temp\Group$.jmpquery", Private );
Target = Open("C:\Temp\Target$.jmpquery", Private );

dtGroup = Group &amp;lt;&amp;lt; Run Background(
	On Run Complete(
	  New Column( "ExGroup",
	    Numeric,
	    "Ordinal", 
	    Formula( :Data ) // this assumes there is a column name :Data in your query
         );
    )
);

dtTarget = Target &amp;lt;&amp;lt; Run Background(
	On Run Complete(
          New Column( "ExTarget",
	    Numeric,
	    "Ordinal", 
	    Formula( :Data ) // this assumes there is a column name :Data in your query
         );	
    )
);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is a similar example, created and tested for JMP sample data Big Class.jmp.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Test = Open("C:\Temp\test.jmpquery",private);

dtTest = Test &amp;lt;&amp;lt; Run Background(
	OnRunComplete(
	  New Column( "ExTest",
	    Numeric,
	    "Ordinal", 
	    Formula( :age ) // this assumes there is a column name :Data in your query
      );
    )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 09:10:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57024#M31985</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-05-15T09:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Working with multiple queries simultaneously</title>
      <link>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57399#M32116</link>
      <description>&lt;P&gt;This would work, however, I'm unsure how to then perform functions using the data from both queries. Also, queryResult is built into the query&amp;nbsp; On Run Complete() function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After some troubleshooting and getting some expert advice, the problem has to do with the queries not finishing before the script moves onto the next command. To solve this, I would need to change the Run Background() to Run Foreground().&amp;nbsp; I've tested it out now and it works great.&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 20:47:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57399#M32116</guid>
      <dc:creator>aserino</dc:creator>
      <dc:date>2018-05-18T20:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Working with multiple queries simultaneously</title>
      <link>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57405#M32119</link>
      <description>Congratulations!</description>
      <pubDate>Fri, 18 May 2018 22:30:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Working-with-multiple-queries-simultaneously/m-p/57405#M32119</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-05-18T22:30:53Z</dc:date>
    </item>
  </channel>
</rss>

