Problem with tag Value Events - Value Change

Hi at all.

currently i try to perform this script in a tag value change events:

  params = {"gaiacode":"APTS503"}
  val = system.db.runNamedQuery("aqualog",params)

When i execute this code in a Script Console the execution finished without error. But inside value change events of every tag in my tag browse it sucks!

Have you got an idea to fix it?

"It sucks!" isn't an Ignition error code. What is the actual error message?


Tip: use the </> to format your code.

I would check if the named query exists in the specified gateway scripting project, if specified at all.

https://docs.inductiveautomation.com/display/DOC81/Project+Library#ProjectLibrary-GatewayScriptingProject

In gateway scope, you need three arguments to runNamedQuery.

2 Likes

I have no errore message.
I use a try-except statement and the only things that i see is that the code skip to except area

Now i try this:

debug = "[default]debugScript"
system.tag.writeBlocking([debug],["c"])
try:
	val = system.db.runQuery("SELECT 1") 
except:
	system.tag.writeBlocking([debug],["d"])

in my debug tag i see “d”

In gateway scope, the database connection name argument to runQuery is required.

Your except: can inspect/print/log the actual exception information via python's sys and/or traceback modules, though you will need a separate except: clause to capture java errors. See this example:

Note that any uncaught errors or logging or printing from gateway scope show up in the gateway log, not in the designer's console or client console. Printing, in particular, only goes to the text-format wrapper log.

{ Have you gone through the lessons in IA's Inductive University ? That would cover many of the basic concepts of Ignition and Python that are tripping you up. }

1 Like

@Alberto_Fagni, please try this going forward:
If you supply snippets on the forums, please either use the UI to format the code using the </> formatting tool, or place all of your code between triple backticks
```
code here
```
to allow for easier reading. I’ll edit your previous posts to assist in this thread, even though you’ve already been directed to the solution to your problems.
Screen Shot 2022-07-17 at 10.30.31 AM

1 Like