Hello,
I have a JSL script that calls for different SQL queries. After the data table is complete, I want to close the queries. Is this possible?
query = Close( "C:\\example.jmpquery" )
does not work.
Thanks.
q1 = Open("C:\myQuery.jmpquery");
q1 << Run Foreground;
q1 << Close Window();
See
Close Database Connection
in the Scripting Index.
I believe that
Close Database Connection( query );
should work
Thanks!
What I want to know if it is possible to close the queries themselves, not necessarily the connection to the database. At the end of the running the script I'm left with 10 open queries which I don't need. Any idea how to close the individual queries?
I assume that you mean by 'query' the resulting JMP data tables. If so, then this example should help you.
// an open query
query = Open Database( ... );
// close query
Close( query, No Save );
Thanks very much for your reply.
I meant the query itself, not the data table. the query that is opened with Select File > New > Database Query.
Is there any way to close this query itself?
Thanks.
I do not have an answer. You might take this problem to JMP Technical Support (support@jmp.com).
I'm not sure what you mean by "closing the query". How are you seeing these queries as "open"? I run multiple SQL queries in my applications, and when I'm done I call close database connection, as Jim indicated. Open tables can be closed with close(<tbl-handle>, nosave) as Mark showed.
This is an example of what I do:
dbc = create database connection("<connection-string>");
sql1 = "SELECT sysdate FROM DUAL";
dt1 = execute sql(dbc, sql1, invisible);
sql2 = "SELECT COUNT(*) FROM all_tables";
dt2 = execute sql(dbc, sql2, invisible);
close database connection(dbc);
Can you share your code?
Thanks for your reply.
My code is something like this:
query1 = Open( "c:/iris/query1.jmpquery" );
query1 << Run Foreground;
query2 = Open( "c:/iris/query2.jmpquery" );
query2 << Run Foreground;
I join the tables that result from these queries, but am left with the open queries themselves.
Any thoughts?
I don't use JMP queries. You might need to contact tech support.
Totally random stab in the dark - would this do the trick?
query1 = Open( "c:/iris/query1.jmpquery" );
query1 << Run Foreground;
query1 = "";
query2 = Open( "c:/iris/query2.jmpquery" );
query2 << Run Foreground;
query2 = "";
q1 = Open("C:\myQuery.jmpquery");
q1 << Run Foreground;
q1 << Close Window();