Named queries not found from gateway scripts

named queries not found from gateway scripts

Caused by: org.python.core.PyException: Traceback (most recent call last): File “”, line 1, in File “”, line 56, in getMissingMinutes at com.inductiveautomation.ignition.gateway.project.ProjectManagerImpl.executeNamedQuery(ProjectManagerImpl.java:2162) at com.inductiveautomation.ignition.gateway.db.namedquery.NamedQueryGatewayRpc.execute(NamedQueryGatewayRpc.java:25) at com.inductiveautomation.ignition.gateway.db.namedquery.NamedQueryGatewayRpc.execute(NamedQueryGatewayRpc.java:15) at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.runNamedQuery(GatewayDBUtilities.java:346) at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) java.lang.Exception: java.lang.Exception: Project “MissingMinutes” not found.

So this is working from the Tools/Script Console
But from a Gatway Event Script, not at all.

What would be the reason for that one?

If you execute from gateway scope you need to include the project name:
https://docs.inductiveautomation.com/display/DOC79/system.db.runNamedQuery

2 Likes

This is already what I am doing

	namedQuery = "MissingHours"
	parameters = {"siteName":siteName,"startDate":lastCheck}
	table = system.db.runNamedQuery("Axium",namedQuery, parameters)

Maybe I need a folder name for the Query name?
Not sure what that would be?

This is for a named query called MissingHours. Are you trying to execute a named query called MissingMinutes somewhere else, perhaps line 56 of a script called getMissingMinutes? Post that part instead.

2 Likes