Question
· Oct 22, 2017

How to Cancel The Execution of a Long Query in DeepSee

Hi, folks!

Suppose you called an MDX which takes a really long period of time.

Is there any way to cancel its execution programmatically?

Discussion (2)1
Log in or sign up to continue

YES it is !

Class %DeepSee.ResultSet has a method %CancelQuery that does the trick.

http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P...

http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P...

Chapter  Using the Result Set API tells you some more details.
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

especially:

If you used %ExecuteAsynch(), periodically check to see whether the query has completed. If the query uses any plug-ins, make sure that any pending results are also complete; pending results are the results from the plug-ins, which are executed separately from the query.

To determine the status of the query, call the %GetStatus() method of your instance. Or call the %GetQueryStatus() class method of %DeepSee.ResultSet. These methods return the status of the query and also (separately) the status of any pending results; see the class documentation for details.

Optionally, to cancel a query that has not yet completed, call the %CancelQuery() class method.

A practical example is seen in ##class( %DeepSee.UI.Analyzer). onunloadHandler()