Query works in script console but returns nothing when run in a WebDev script

I have a simple SQL query to grab a couple values from a database. This database is rarely used by our Ignition system. This is contained in a WebDev "doPost" script using system.db.runPrepQuery.

When I run this query in the script console with the proper parameter, I get the expected result. But when I run the doPost method and feed this same query the same exact parameter, it is grabbing nothing. So I can't get the script as a whole to function. Note that it is not throwing an error; it is simply returning an empty result.

My first thought was our gateway's Windows service account lacks access to the database being queried. Except we have a couple 'shared' / global scripts which make successful calls to this same database -- so this leads me to believe the problem is elsewhere.

So my question is, where would I look next? Are there any quirks with the Web Dev module that might 'block' a query in this fashion?

WebDev runs in Gateway scope, and many system functions have different behavior than in Vision (which is what the designer script console is). There are scope notes in the documentation explaining the differences, when applicable.

So, for example, when running in the gateway scope specifying the database is not optional. (The script console may be picking it up from the project's default database configuration in the project properties.)

Here's a link to the relevant section of the system.db.runPrepQuery doc.

1 Like