Ignition edge how to convert a dataset tag into a Python dataset

I have a button that reads a tag with a dataset and then convert it into a Python dataset just for ease of code. But I cannot get it to work. I am using Ignition Edge version 8.1.24.

Here is my code:
GroupDataSetTagPaths = ["[edge]UT/Loop1_GroupDataSet"]
pyGroupDataSet = system.dataset.toPyDataSet(system.tag.readBlocking(GroupDataSetTagPaths).value)

Here is the tag information:

Here is the error code:
09:55:12.255 [AWT-EventQueue-0] ERROR com.inductiveautomation.ignition.client.util.gui.ErrorUtil - Error running action 'component.onActionPerformed' on UT Platform/Top MenuLoop1Configuration@D/root/ButtonRunLoop1: Traceback (most recent call last):
File "function:runAction", line 99, in runAction
AttributeError: 'java.util.ArrayList' object has no attribute 'value'

com.inductiveautomation.ignition.common.GenericTransferrableException: Traceback (most recent call last):
File "function:runAction", line 99, in runAction
AttributeError: 'java.util.ArrayList' object has no attribute 'value'

at org.python.core.Py.AttributeError(Py.java:178)
at org.python.core.PyObject.noAttributeError(PyObject.java:965)
at org.python.core.PyObject.__getattr__(PyObject.java:959)
at org.python.pycode._pyx162.runAction$1(<function:runAction>:322)
at org.python.pycode._pyx162.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:846)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:828)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:832)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:1009)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:897)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:147)
at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:74)
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: com.inductiveautomation.ignition.common.GenericTransferrableException: AttributeError: 'java.util.ArrayList' object has no attribute 'value'
... 28 common frames omitted

system.tag.readBlocking returns a list/array of QualifiedValue when given a list.

You need something like:

GroupDataSetTagPaths = ["[edge]UT/Loop1_GroupDataSet"]
ds = system.tag.readBlocking(GroupDataSetTagPaths)[0].value
pyGroupDataSet = system.dataset.toPyDataSet(ds)

Thanks Kevin. That was a quick response. That is one of the many things I like about ignition. The Community is very helpful and respond very quickly.

Even when not given a list...

1 Like

Oh yeah that's right, but there's a confusing special case where it allows you to give it a scalar path instead of a list of paths, but the result is still a list.