I have a SQL function
dbo.machine_availablity() with a parameter of int
and a return value of float.
In a Client tag, it returns a number between 0 & 100 as expected. In a gateway tag with identical syntax and parameter, it returns 0. The tag shows good status and there are no generated errors.
Other queries work on Gateway tags; the database connection is fully functional and the SQLTag provider is pointing the correct connection.
(Ignition 7.6.4 served by Win 8.1 with SQL Server 2008, designer running on OS X 10.9)
I tried this with an expression tag and it seems to be working fine for me:
executeScalarQuery("SELECT dbo.machine_availability(0)", "LocalDB")
Yes, it’s all a matter of how the query is interpreted… client tags always run them as a “query”, whereas on the gateway, I believe it’s running this as if it were an update… and thus returning 0, for “0 rows updated”.
This has been addressed in 7.7, where you can override the interpretation, but in the mean time, use an expression tag with the function suggested by adamaustin. (Actually, if you can use it with “SELECT …”, it should work in a query tag as well)