# Add columns to a dataset in module sdk

**URL:** <https://forum.inductiveautomation.com/t/add-columns-to-a-dataset-in-module-sdk/69114>\
**Category:** Module Development\
**Tags:** scripting\
**Created:** [January 27, 2023, 9:50pm UTC](https://forum.inductiveautomation.com/t/add-columns-to-a-dataset-in-module-sdk/69114 "2023-01-27T21:50:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Munoz\_Vasq](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@Sebastian\_Munoz\_Vasq](https://forum.inductiveautomation.com/u/Sebastian_Munoz_Vasq)\
**Post date:** [January 27, 2023, 9:50pm UTC](https://forum.inductiveautomation.com/t/add-columns-to-a-dataset-in-module-sdk/69114/1 "2023-01-27T21:50:09Z")

</div>

Hello,  
I have a BasicStreamingDataset "dataset" that I obtained from a queryHistory in java, I want to add additional columns to it but I have problems to do it or how you could create a new dataset with the columns you wish from the one obtained in the query?.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 27, 2023, 10:11pm UTC](https://forum.inductiveautomation.com/t/add-columns-to-a-dataset-in-module-sdk/69114/2 "2023-01-27T22:11:36Z")

</div>

You have to make a new one and copy the rows. Datasets are not mutable after creation. (Well, not supposed to be.)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 28, 2023, 2:25am UTC](https://forum.inductiveautomation.com/t/add-columns-to-a-dataset-in-module-sdk/69114/3 "2023-01-28T02:25:34Z")

</div>

Create a new dataset using [system.dataset.addColumn](https://docs.inductiveautomation.com/display/DOC81/system.dataset.addColumn), then replace the original dataset with the new one. The added column will need to have the exact same number of rows as the original dataset.
