If you want the data table that results from the background query, use the OnRunComplete optional argument. You can include a script that runs when the query completes and then assigns a data table reference to the resulting data table. Or you might pass the name of a function that accepts a data table as its first argument. That function is called when the query completes.
query = Open( "c:/My Data/Movies.jmpquery", private);
dt = query << Run();
You can include a .jmpquery file in a script and run the query in the background using the <<Run Background message.
query = Include( "C:/Queries/movies.jmpquery");
query <<Run Background();
confirmation = Function( {dtResult},
Write( "/!NNumber of rows in query result: ", N Rows( dtResult ) )
);
query = New SQL Query(
Connection(
"ODBC:DSN=SQL Databases;APP=MYAPP;TrustedConnection=yes;WSID=D79255;DATABASE=SQB;"
),
QueryName( "movies_to_update" ),
Select( Column( "YearMade", "t1" ), Column( "Rating", "t1" ) ),
From( Table( "g6_Movies", Schema( "SQB" ), Alias( "t1" ) ) ),
);
query << Run( OnRunComplete( confirmation ) );
Null (or the data table object, if OnRunComplete is included).
Optional. Specifies a script to run after the query is complete. To get the resulting data table, include OnRunComplete.
Optional. Does not open the resulting data table. Specify only with OnRunComplete. If you include private in a background query, JMP opens the data table as invisible instead. Using private data tables saves memory for smaller tables. However, for large tables (for example, 100 columns and 1,000,000 rows), using a private data table is not helpful because the data requires a lot of memory.
All queries except for SAS queries run in the background based on the Query Builder preference “Run the queries in the background when possible”, which is selected by default. For SAS queries, Run Background() is ignored.
You can include a .jmpquery file in a script and run the query in the background using the <<Run Background message.
query = Include( "C:/Queries/movies.jmpquery");
query <<Run Background();
See Run Background(<OnRunComplete(script), <private|invisible>>, <OnRunCanceled(script)>, <OnError(script)> for details about the arguments.