Script Module

I am trying to write a script to update the content of a table so I do not need to use many cell binding calls and make it easier to update in the future.

I added the following script as a module

[code]def getFaultDataset():

stations = [2,9,10,11,12,13,14,17,20,21,23,25,26,27,36,38,42]
headers = ["Station", "Station Description", "Shift Faults", "Fault Percentage"]
data = []
for station in stations:
	desc ="[]BodineB/Stations/" + station + "/Enabled.Tooltip")
	data.append([row, desc, "", ""])
return system.dataset.toDataSet(headers, data)[/code]

Then in my table object I bound to this expression

runScript("app.getFaultDataset()", 10000)

However, I am getting the following error when it runs…

[code]Exception: Error executing expression binding on
caused by ExpressionException: Error executing script for runScript() expression:app.getFaultDataset()
caused by Traceback (most recent call last):

File “expression:runScript”, line 1, in

TypeError: ‘com.inductiveautomation.ignition.common.script.ScriptModule’ object is not callable

Ignition v7.5.4 (b1206)
Java: Sun Microsystems Inc. 1.6.0_23

Any help as to what I might be doing wrong?

To call an app function you must specify a module app.something.someFunction. You are just missing the middle part.runScript("app.myModule.getFaultDataset()", 10000)

Awesome! Thanks, got it working. :thumb_left: