# Modifying a sql query dataset

**URL:** <https://forum.inductiveautomation.com/t/modifying-a-sql-query-dataset/95378>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [August 30, 2024, 4:07pm UTC](https://forum.inductiveautomation.com/t/modifying-a-sql-query-dataset/95378 "2024-08-30T16:07:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Ervin](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@Eric\_Ervin](https://forum.inductiveautomation.com/u/Eric_Ervin)\
**Post date:** [August 30, 2024, 4:07pm UTC](https://forum.inductiveautomation.com/t/modifying-a-sql-query-dataset/95378/1 "2024-08-30T16:07:22Z")

</div>

Im returning a dataset to an xy chart with a sql query binding.

Im wanting to modify the incoming data for formatting. The first column is return a value of volt amps. Id like to divide the value by 1000 to return kva value. Also Id like to use the round function to keep it from 8 decimal places.

Is it possible to do this on a per column basis?

---

<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:** [August 30, 2024, 4:16pm UTC](https://forum.inductiveautomation.com/t/modifying-a-sql-query-dataset/95378/2 "2024-08-30T16:16:50Z")

</div>

> [@Can I modify an entire column from a dataset with system.dataset.setValue()?](https://forum.inductiveautomation.com/t/can-i-modify-an-entire-column-from-a-dataset-with-system-dataset-setvalue/87043/3):
>
> def mapColumn(function, dataset, column): if isinstance(column, basestring): column = dataset.getColumnIndex(column) columnData = map(function, dataset.getColumnAsList(column)) columnsToKeep = range(dataset.columnCount) columnsToKeep.pop(column) dsWithoutColumn = system.dataset.filterColumns(dataset, columnsToKeep) return system.dataset.addColumn( dsWithoutColumn, column, columnData, dataset.getColumnName(column), dataset.getColumnType(column) ) It's relatively easy to…

You can drop something like this in your project library, to call a transformation function on an entire column of a dataset as one operation.

Phil's Integration Toolkit module also probably has some neat capabilities here.

---

<div class="post-metadata">

**Author:** ![Eric\_Ervin](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@Eric\_Ervin](https://forum.inductiveautomation.com/u/Eric_Ervin)\
**Post date:** [September 4, 2024, 12:13pm UTC](https://forum.inductiveautomation.com/t/modifying-a-sql-query-dataset/95378/3 "2024-09-04T12:13:22Z")

</div>

Appreciate this, can you give an example or point me in the direction of applying this function to a query binding?
