I am storing values from a CompactLogix PLC into a SQL DB table.
In SQL, I am using datatype decimal (5,3)
I have a value stored in the DB of 33.515
When I retrieve that value into the Power Table it displays as 33.52
The data format that I am using in the Power Table is #,##0.00. I have also tried #,##0.## with the same results
I only want to display 2 digits after the decimal place and do not want the value rounded.
Below is the current query. Would I need to replace SELECT * with all the columns I am selecting and then use the truncate on only the 2 columns that are rounding?
#Define the search based on what is in the lot number text box
search = event.source.parent.getComponent('Lot Number').text
#Query the databse
results= system.db.runPrepQuery("SELECT * FROM NewTraceData WHERE WO = ?", [search])
#Populate the table with the results
event.source.parent.getComponent('Power Table').data = results
SELECT *, truncate(value,2) as TruncatedValue FROM ....
and it will return the truncated value as an extra column at the end. Just go into the power table and hide the non-trucated column. This would save you from typing a bunch of extra column names, but it isn’t exactly an efficient query.