Is there any way to cancel a running query ?

I have two questions…

#1) Is there any way to cancel a query that has already started ?
For example, let’s say a user puts a form into ‘find’ mode, specifies some search criteria then initiates a ‘search’ and then wants to cancel the running query. Is this possible in any way via Servoy ?

#2) Is there any way to cancel out of ‘find’ mode ?
Same situation as above in that the user puts a form into ‘find’ mode and then decides they don’t want to be in ‘find’ mode afterall.
Can they cancel out of ‘find’ mode ? If so, will the previously queried data remain ?

about 1:

servoy doesnt support this, there is support for cancel at the java level (but this is totally dependend if the driver/database also supports this so it doesnt have to do anything)
So in a next version we could support cancel (if the db supports it) if needed.

about 2:

You can discard find mode using ESC, “Show all” menu item, javascript call to controller.loadAllRecords(). But it is not exactly a cancel (it performs the search to exit find mode and then loads all records).
And it will not go back to pervious query, but rather show all records.

You can create a case in our support system to request a genuine cancel find operation.

Enhancement request submitted :)

markhooper:
Enhancement request submitted :)

Was this enhancement request implemented ? I mean : how to cancel current find without loosing foundset contents.

Hi,

I was wondering if there has been any progress made on the enhancement? I would like to exit out of find mode programatically. But, after searching through all of the forums I am unable to see any progress made on this enhancement. Could anyone out there provide me with a snippet of code that could allow a user to cancel a find without performing a search?

Thank you

no there is not progress on this
And this will also not be very easy to do. There are loads of issues with this not all in the hand of server.

If you do a find. Then that find is send to the server, then if you want to cancel that one, we have to call the server again with another call
that really targets that other first one. Then get there the connection/statement that is used by that specific thing.
Then call Statement.cancel() and then hope that the jdbc driver or the database really implement and support it…

Johan,

I think the last posts were about the original poster’s question #2. So about how to get out of find mode (no query running yet whatsoever) and keep the original foundset that existed before coming into findmode.
That’s all in the hands of Servoy client and perhaps Server.

Hi Johan,

Thank you for the information. I understand what you are saying.

Another question related to this would be, is there any way to cancel the controller find mode when it has not been run/executed? I have users that may put a form into find mode, but then decide that they no longer wish to run a find. All they would want to see is the existing foundset without having to run another search to exit find mode.

Thanks

Pressing escape should cancel the find.

Paul

Hi pbakker,

i have read that using the escape key works, but I need that functionality to be assigned to a button for users. I have tried the escape key and it doesn’t seem to work in the solution that I am working on, which is fine, as we are looking to utilize code to handle this functionality.

Any ideas on what the code might be to achieve this same functionality as pressing the “ESC” key?
Currently I am using the following code, but it still performs a search.

forms.list.foundset.find();

if (columnValue == null)
      forms.list.controller.search(null, null);
else
      forms.list.foundset.search();

Thanks

currently the only thing escape does you also can do in code

controller.loadRecords()

that will cancel your find, but will result in a loadAllRecords.

We currently dont support going back to the foundset you where on before you started find.

Hi Johan,

I tried the controller.loadRecords() method you suggested, but it doesn’t seem to cancel the form being in find mode. It seems to take about the same time as just running a search, and does not appear to have any sort of performance increase.

Are there any other work arounds for this problem?

Thanks

a query will happen currently because search() will do a query with the search criteria and loadRecords() will do a query with just no where statement.
If you just want max performance with no queries you could try to do foundset.clear()