Gets (without the newName argument) or sets (with the newName argument) the name of the query. The name of the query is used as the name of the data table that results from running the query.
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. 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.
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();

Help created on 7/12/2018