# Power Table Rounding Up

**URL:** <https://forum.inductiveautomation.com/t/power-table-rounding-up/20863>\
**Category:** Ignition\
**Created:** [November 14, 2018, 6:56pm UTC](https://forum.inductiveautomation.com/t/power-table-rounding-up/20863 "2018-11-14T18:56:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmcallister](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bmcallister](https://forum.inductiveautomation.com/u/bmcallister)\
**Post date:** [November 14, 2018, 6:56pm UTC](https://forum.inductiveautomation.com/t/power-table-rounding-up/20863/1 "2018-11-14T18:56:28Z")

</div>

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.

Any ideas?

Thanks!

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 14, 2018, 8:28pm UTC](https://forum.inductiveautomation.com/t/power-table-rounding-up/20863/2 "2018-11-14T20:28:25Z")

</div>

In your query use

```auto
SELECT truncate(value,2)
From Table

```

---

<div class="post-metadata">

**Author:** ![bmcallister](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bmcallister](https://forum.inductiveautomation.com/u/bmcallister)\
**Post date:** [November 14, 2018, 10:03pm UTC](https://forum.inductiveautomation.com/t/power-table-rounding-up/20863/3 "2018-11-14T22:03:17Z")

</div>

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?

```auto
#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

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 15, 2018, 12:12am UTC](https://forum.inductiveautomation.com/t/power-table-rounding-up/20863/4 "2018-11-15T00:12:26Z")

</div>

It depends on the other columns. If any are of type string, then you will need to type out all the columns.

---

<div class="post-metadata">

**Author:** ![Brian](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@Brian](https://forum.inductiveautomation.com/u/Brian)\
**Post date:** [November 15, 2018, 12:57am UTC](https://forum.inductiveautomation.com/t/power-table-rounding-up/20863/5 "2018-11-15T00:57:53Z")

</div>

You could also do

```auto
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.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [November 15, 2018, 3:56pm UTC](https://forum.inductiveautomation.com/t/power-table-rounding-up/20863/6 "2018-11-15T15:56:58Z")

</div>

Just add some script in the configureCell for that float column to format the value.
