System.tag.configure UDT dataset parameter

How do I use system.tag.configure to send a dataset as a parameter to a dataset memory tag in a UDT?

Right now when I send the dataset from my table I get the following error:

10:34:20.654 [AWT-EventQueue-0] ERROR Scripting[util_tag] - Error converting PyTagDictionary to tag edit:
java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: java.lang.String. Forgot to register a type adapter?
at com.inductiveautomation.ignition.common.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:73)
at com.inductiveautomation.ignition.common.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:69)
at com.inductiveautomation.ignition.common.gson.TypeAdapter$1.write(TypeAdapter.java:191)
at com.inductiveautomation.ignition.common.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
at com.inductiveautomation.ignition.common.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:97)
at com.inductiveautomation.ignition.common.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:61)
at com.inductiveautomation.ignition.common.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
at com.inductiveautomation.ignition.common.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:127)
at com.inductiveautomation.ignition.common.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:245)
at com.inductiveautomation.ignition.common.gson.Gson.toJson(Gson.java:704)
at com.inductiveautomation.ignition.common.gson.Gson.toJsonTree(Gson.java:597)
at com.inductiveautomation.ignition.common.gson.Gson.toJsonTree(Gson.java:576)
at com.inductiveautomation.ignition.common.TypeUtilities.pyToGson(TypeUtilities.java:1729)
at com.inductiveautomation.ignition.common.TypeUtilities.lambda$pyToGson$1(TypeUtilities.java:1714)
at java.base/java.lang.Iterable.forEach(Unknown Source)
at com.inductiveautomation.ignition.common.TypeUtilities.pyToGson(TypeUtilities.java:1714)
at com.inductiveautomation.ignition.common.TypeUtilities.lambda$pyToGson$1(TypeUtilities.java:1714)
at java.base/java.lang.Iterable.forEach(Unknown Source)
at com.inductiveautomation.ignition.common.TypeUtilities.pyToGson(TypeUtilities.java:1714)
at com.inductiveautomation.ignition.common.TypeUtilities.pyToGson(TypeUtilities.java:1696)
at com.inductiveautomation.ignition.common.tags.TagUtilities.toTagConfiguration(TagUtilities.java:127)
at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.dictToTagEdits(AbstractTagUtilities.java:183)
at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.lambda$configure$0(AbstractTagUtilities.java:144)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.configure(AbstractTagUtilities.java:144)
at jdk.internal.reflect.GeneratedMethodAccessor683.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:188)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.call(ScriptManager.java:518)
at org.python.core.PyObject.call(PyObject.java:413)
at org.python.pycode._pyx351.f$0(event:actionPerformed:50)
at org.python.pycode._pyx351.call_function(event:actionPerformed)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:761)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:187)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:278)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
at com.sun.proxy.$Proxy55.actionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Post the script that you are using

dsData = event.source.parent.getComponent(‘table’).data

tagName = “myTag”
typeId = “myUdt”
tagType = “UdtInstance”

tag = {
“name”: tagName,
“typeId” : typeId,
“tagType”: tagType,
“parameters” : {
“dsData” : dsData
}
}

collisionPolicy = “m”

system.tag.configure(basePath=“myTagProvider”, tags=[tag], collisionPolicy=collisionPolicy)

I haven’t switched to Ignition 8 yet so I can’t test this right now. Try contacting support if no one else chimes in

I switched from sending parameters to the UDT to just configuring the tag without parameters and then immediately writing the values to all the tags within the instance after configuration. Seems to work just fine.

1 Like