runScript and dataset


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

runScript("doSth(" + {Root} + ")")

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

Also, what is trying to execute the runScript?


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.