Hey all,
Having a hell of a time with this.
No matter what I do to an OPC Float tag in a transaction group I can not get it to round the decimal places to 2.
I have tried the following:
Formatted the tag on the tag itself with “#.#”, “#.00”, “0.00”
Created an expression tag in the transaction group using numberFormat({Tag},"#.00") (and variations of the above formats)
Created an expression tag in the transaction group using round({Tag},2) (and variations of the above formats)
Created an actual expression tag in the tag folder trying all of the above different formats.
The value will still get written to the database with more decimals than wanted.
Created a derived tag in the tag folder utilizing round, numberFormat, etc.
Format it in the SQL INSERT statement. Post yours to show us how you’re doing it.
Most of us would probably store at supplied resolution and format it on retrieval from the database.
Tip: use `` backticks to format code. e.g., the expression language numberFormat({Tag}, "#.00"). For pasting blocks of code use the </> code formatting button.
If the column type in the DB is REAL, they you might simply be getting the closest binary approximation of the two decimal places you want. Any level of rounding for decimals upon binary representations has to be performed at the point of display, not the point of storage.