Can I read SQLTags in FSQL?
I want to add noise to a value for a demo. I have OPC tags generating random numbers. I want to multiply this random number times a value from my database. However, I don’t have and can’t buy the ODBC driver for OPC.
If I could read a SQLTag in FSQL, I could get the value from my database that way, and thought that I could do what I needed in an action item.
Alternatively, I suppose I could write a script to run periodically to do this in FPMI, but I have run up against some walls on that route.
Guidance, please. Thanks.
You can do this all within the SQLTags system. Make the following tags:
OPCValue = OPC Tag value from your OPC server
RandValue = DB Tag bound to a SQL Query expression doing a “SELECT RAND()”
NoiseValue = DB Tag bound to an expression that is OPCValue * RandValue
Hope this helps,
I would have thought that. In fact, I tried it, to no avail.
I have two SQLTags. One is reading a value from my database, the other is simulator data from KepServerEX. Both show up as good data in the SQLTags Browser.
A third SQLTag multiplies them.
This tag contains null data and quality is “expression-eval-error”. All are floats.
You should get details on the expression eval error in the diagnostics page (help > diagnostics)
I saw the error report that you submitted about this - are you sure both tags are numeric? Maybe one is a string by mistake?
You could try throwing a toDouble() cast around both tags, let us know if that helps.
All were float4. When I changed the random number tags to float8, all is well. This even though the SQLTag Browser shows good data quality with either float4 or float8.