Named Query Returning Output


I am somewhat new to Ignition. We are using Perspective. On an Update I'd like to return an update parameter that is an Output.


IE if successful it returns 1 else 0.


When calling from a script I will check this variable if its 0 I can popup an error message, if 1 I can pass a Success message. I have the popups set up but cant figure out how to pass output parameters back in the script to know if it was rolledback or updated.

How are people currently doing this via Named Queries?

Or is there something built in that I know if its fully successful or not. Inserting into a changelog so there are over 8 update statements with inserts to changelog.

Thanks for any advice.

It looks like maybe this is a snipit from your DB Managment system, if not then you should avoid SQL scripts, as SQL scripting isn't in the JDBC spec., even if some drivers tolerate them.

If this isn't already a stored procedure then it probably should be. There are multiple ways that a SP can be run from Ignition.

However, you should know that you can use system.db.beginNamedQueryTransaction() to create and run named queries in a transaction, you really don't need return the status of the transaction from the query. (If that is all the stored procedure is intended to do). If you do this, you should not use a transaction inside of the query or stored procedure.

Also, a named query by default returns the number of effected rows, which, would indicate if the transaction was committed or rolled back, as a rolled back transaction by definition can not effect any rows.

More information on when different tools for running queries in ignition should be used can be found here:

1 Like

Yes, it is a stored procedure running from db management system.

Thanks this has given me an idea how to get this to work.

Appreciate the time it took you to reply.