# How to format a number in a report table

**URL:** <https://forum.inductiveautomation.com/t/how-to-format-a-number-in-a-report-table/80970>\
**Category:** Ignition\
**Tags:** ignition81, reporting\
**Created:** [October 25, 2023, 3:56pm UTC](https://forum.inductiveautomation.com/t/how-to-format-a-number-in-a-report-table/80970 "2023-10-25T15:56:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Carlton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim_carlton/32/52835_2.png) [@Tim\_Carlton](https://forum.inductiveautomation.com/u/Tim_Carlton)\
**Post date:** [October 25, 2023, 3:56pm UTC](https://forum.inductiveautomation.com/t/how-to-format-a-number-in-a-report-table/80970/1 "2023-10-25T15:56:30Z")

</div>

I have a report with two data sources - a static data source and a script data source. There are two columns - a name and a numeric value. They have the same data (within data type constraints).  
I have displayed the data in tables. The value column is formatted as`#,##0`.

The static data is shown as expected - rounded to 0 decimal places and a thousands separator. The calculated data is not formatted.

Ignition 8.1.28

Screenshots (because I don't see a json export)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/9/092c8ec68c8b8fb2e9bbf3fc90eb43e7c3b768dd.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/5/f53dbe95d4d2341ed41decf27777e4b9a5e1ecfe.png)

> **static\_data**
>
> ```auto
> Meter, Value
> "Static Meter 1", 32191.110980111298
> "Static Meter 2", 8.1
> 
> ```

> **script\_data**
>
> ```auto
> def updateData(data, sample):	
> header = ['Meter', 'Total']
> rows = []
> 	
> dataset = system.dataset.toDataSet(header, rows)
> 		
> data['Computed_Totals'] = dataset
> 
> firstValue = 2343.123345234235623434
> secondValue = 34534.234325345534534563453
> 
> total1 = secondValue - firstValue
> newRow = ['Calc Meter 1',total1]
> dataset = system.dataset.addRow(dataset, newRow)	
> 
> total2 = 8.1
> newRow = ['Calc Meter 2',total2]
> dataset = system.dataset.addRow(dataset, newRow)	
> 
> data['Computed_Totals']=dataset
> 
> ```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 25, 2023, 5:16pm UTC](https://forum.inductiveautomation.com/t/how-to-format-a-number-in-a-report-table/80970/2 "2023-10-25T17:16:20Z")

</div>

`toDataset` defaults to string if no more specific type can be inferred from the data. Since you're not specifying a row, your column will be of type string, not a true number.

Just build your dataset _last_.

---

<div class="post-metadata">

**Author:** ![Tim\_Carlton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim_carlton/32/52835_2.png) [@Tim\_Carlton](https://forum.inductiveautomation.com/u/Tim_Carlton)\
**Post date:** [October 25, 2023, 5:36pm UTC](https://forum.inductiveautomation.com/t/how-to-format-a-number-in-a-report-table/80970/3 "2023-10-25T17:36:28Z")

</div>

Thanks.  
So when I was displaying `type(newRow[1])` that was before the conversion. I should have displayed `type(dataset[0][1])` instead.  
And `total2 = round(8.1, 0)` was showing 8.0, so the automatic conversion defaults to one decimal place in that circumstance?
