# runScript and dataset

**URL:** <https://forum.inductiveautomation.com/t/runscript-and-dataset/9086>\
**Category:** Ignition\
**Created:** [September 22, 2014, 2:01pm UTC](https://forum.inductiveautomation.com/t/runscript-and-dataset/9086 "2014-09-22T14:01:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DawidF](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@DawidF](https://forum.inductiveautomation.com/u/DawidF)\
**Post date:** [September 22, 2014, 2:01pm UTC](https://forum.inductiveautomation.com/t/runscript-and-dataset/9086/1 "2014-09-22T14:01:17Z")

</div>

Hello,

How can I run the script using expression with ‘RunScript’ when I want to run a function with a DataSet as an argument  
like

```auto
runScript("doSth(" + {Root Container.Machine.TbParts.data} + ")")
```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 22, 2014, 2:56pm UTC](https://forum.inductiveautomation.com/t/runscript-and-dataset/9086/2 "2014-09-22T14:56:08Z")

</div>

Looks like that should pass ok. What sort of error are you getting?

Also, what is trying to execute the runScript?

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 22, 2014, 3:28pm UTC](https://forum.inductiveautomation.com/t/runscript-and-dataset/9086/3 "2014-09-22T15:28:55Z")

</div>

Hi,

You cannot pass a dataset to a function that is called with runScript. You can only pass string arguments to functions called with runScript (because you can only pass a string to runScript).

You have a couple different things that you can do instead. You could convert the dataset into a string format and pass that. For example you could use the system.dataset.toCSV and system.dataset.fromCSV functions.

Or you can pass in the name of the window and then in your doSth function use system.gui.getWindow to get the window and then drill down into the window to get the dataset.

I know that these solutions don’t seem nice. In my experience using runScript is sometimes awkward.

Best,
