[Bug-12521] Project Named Query Issues

Hi everyone,

I am having an issue with named queries in the project browser. I am creating some simple named queries that work in the named query testing environment, work outside of Ignition in SQL Server, and work by calling the system.db.runPrepQuery function, but do not work when using the system.db.runNamedQuery function.

The error I am receiving when inputting in the script console:

Traceback (most recent call last):
File “”, line 1, in
UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u2179’ in position 12: ordinal not in range(128)

This is a very generic Python error, but I cannot get past it. Tried encoding things to no avail, even returning a single 0 (“SELECT 0”) causes this issue.

Is this a scoping issue? Or some bug in running this function via scripting console?

When I try calling this function within Perspective, it simply tells me that the project name is not found - adding the project name as the first argument makes this work perfectly fine. So it looks like within perspective, you need to call the project name as the first argument in order to run the named query. That seems strange at first, but I think it makes sense if all scripts are now gateway-scoped. But that begs the question of why it doesn’t seem to function in the scripting console? Any ideas?

In addition, I seem to have a problem with my scripting environment, where the text look/feel is strange and the cursor do not line up properly. It’s off by about 1-2 spaces, so backspacing sometimes erases the incorrect character. Tabbing and spacing are the same. It doesn’t seem to be a problem on my VM, but on my host machine, so I imagine it is some configuration I don’t know about. Ideas?

Best,
Roger

https://docs.inductiveautomation.com/display/DOC80/system.db.runNamedQuery
The query in question behaves differently depending on whether you're using it in perspective or Vision (Perspective use requires a project path because it's running on the Gateway, whereas the Vision version is running locally and so it only has its own project to use).

That being said, the whole u'\u2179' (SMALL ROMAN NUMERAL TEN) issue is unexpected and I'll open a ticket immediately. There's no reason you should need to worry about encoding when doing something as simple as a db query.

As for the scripting cursor issue: did you happen to move the scripting panel/window from one screen to a different screen? We've noticed that behavior in that situation. If you're not moving the window around, is your monitor High or Low DPI? Is this only happening in the script window, or does the same thing happen if you're editing a text Area which has several lines of text?

1 Like

Ah, please see

1 Like

This issue was fixed in the build that was uploaded today (2/27). Please let us know if you continue to see this behavior after upgrading.

1 Like