Hello,
I have script implemented which fires NamedQuery on certain condition. There are multiple queries I am firing in consecutively. So for this queries I am taking one query parameter say IdNumber which is present in all of my tables. And when new IdNumber is entered, that means user requested to see data for entered IdNumber, hence all queries will be fired again consecutively.
What happens is sometimes say I have 5 queries to run consecutively and 1-2-3- 3rd took lot of time to return data (more than 2-3 mins) so 4th query will run only if 3rd is completed. Sometimes In Between user requests newer IdNumber data which gets in queue, so is there a way I could cancel current running query on gateway and runQuery with newer? Also if certain query takes longer to execute I would like to send cancel request to it too.
Please suggest
There is no way to cancel a query in progress. It is no longer in Ignition's hands, and there's no generic way (JDBC) to invoke such a feature in a client driver. You will have to prevent the problem from happening in the first place:
Arrange for your UI to disable further changes while such queries are in progress. So your operator cannot submit another IdNumber before the prior one returns.
I tried that however sometimes the query keeps on running and goes out of queue automatically without timeout error.. that way my UI stuck disabled
Figure out why your queries are timing out. That is a separate problem that needs to be addressed. A query used in a user interface should never take more than a second or two. Optimize the DB, use pre-computed summary tables, or constrain the limits (time frames, etc) to ensure your UI queries are quick.
2 Likes