I have put a dataSet on Parameters,
and I would like export then on excel/CSV file.
dataDS = self.view.params.pData #table.data
system.dataset.exportExcel("test.xls",1, dataDS)
error:
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
File "<function:runAction>", line 3, in runAction
TypeError: can't convert u'value' to com.inductiveautomation.ignition.common.Dataset
caused by org.python.core.PyException
Traceback (most recent call last):
File "<function:runAction>", line 3, in runAction
TypeError: can't convert u'value' to com.inductiveautomation.ignition.common.Dataset
Ignition v8.1.38 (b2024030513)
Java: Azul Systems, Inc. 17.0.9
First time I'am tryng to export data. someone can help ?
You are trying to export a string value
to excel. The exportExcel system function expects a dataset.
headers = ['test']
data = [['value']]
dataDS = system.dataset.toDataSet(headers,data)
...
Thank you @dkhayes117
I do this script but I'am getting another error:
headers = []
data = []
DS = self.parent.parent.parent.getChild("CorpEvenement").props.params.Data
for row in DS:
if not headers:
headers = row.keys()
data.append([val for key,val in row.iteritems()])
dataDS= system.dataset.toDataSet(headers,data)
#dataDS = self.parent.parent.parent.getChild("CorpEvenement").props.params.Data #table.data
system.dataset.exportExcel("test.xls",1, dataDS)
errror:
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
File "<function:runAction>", line 16, in runAction
AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'exportExcel'
at org.python.core.Py.AttributeError(Py.java:176)
at org.python.core.PyObject.noAttributeError(PyObject.java:965)
at org.python.core.PyObject.__getattr__(PyObject.java:959)
at org.python.pycode._pyx1905.runAction$1(<function:runAction>:16)
at org.python.pycode._pyx1905.call_function(<function:runAction>)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyFunction.function___call__(PyFunction.java:474)
at org.python.core.PyFunction.__call__(PyFunction.java:469)
at org.python.core.PyFunction.__call__(PyFunction.java:464)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:847)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:829)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:868)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:1010)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:950)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:161)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:98)
at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:80)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(ActionCollection.java:263)
at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(LoggingContext.java:54)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:252)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:221)
at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$TaskWrapper.run(BlockingTaskQueue.java:154)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.inductiveautomation.perspective.gateway.threading.BlockingWork$BlockingWorkRunnable.run(BlockingWork.java:58)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException
Traceback (most recent call last):
File "<function:runAction>", line 16, in runAction
AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'exportExcel'
... 29 more
Ignition v8.1.38 (b2024030513)
Java: Azul Systems, Inc. 17.0.9
exportExcel() will not work in perspective. Use toExcel() instead.
1 Like
I missed the perspective tag
I'am gatting the same error
TypeError: can't convert 1 to com.inductiveautomation.ignition.common.Dataset
toExcel has different parameters and return value.
Pause.
Take a second.
Use the autocomplete (Ctrl+Space).
Try to solve your own problems.
3 Likes
WOW.............
WHY WAS THIS HIDDEN FROM ME........
I will forever use this: