Value changed doesn't work

Hi,
I added in value changed of a memory tag (Input) a script that allows you to write a value to another tag (output) with system.tag.write.
When I go to manually change the value of the memory tag (input) does not write the value that I put in the value changed.

I enclose a photo of the script.

Thanks


I haven’t used tag event scripting before so I might not understand how it works, but it looks to me like you are defining a function but never calling it.

Don’t you need a statement to call the function after you have defined it?

According to this video, I’m doing the right thing: inductiveuniversity.com/video/t … /scripting.

I think that the value changed is called when changing value in the Tag.

Is the designer in read/write mode?

Hi Andrea,

Are your tags in a folder?

If so you need to use a period instead of a tilda, like this:

system.tag.write("[.]output",67)

Best,

I tried in another gateway and it works.

I think that the problem is in the configuration gateway. Infact when i create a new project in this gateway in output console there is this error:
Exception in thread “AWT-EventQueue-2” java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(Unknown Source)
at java.util.TimSort.mergeAt(Unknown Source)
at java.util.TimSort.mergeForceCollapse(Unknown Source)
at java.util.TimSort.sort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at sun.awt.datatransfer.DataTransferer.setToSortedDataFlavorArray(Unknown Source)
at sun.awt.datatransfer.DataTransferer.getFlavorsForFormatsAsArray(Unknown Source)
at sun.awt.datatransfer.SunClipboard.getAvailableDataFlavors(Unknown Source)
at com.inductiveautomation.ignition.designer.sqltags.dialog.TagBrowserPanel$TagBrowserActionHandler.canPaste(TagBrowserPanel.java:468)
at com.inductiveautomation.ignition.designer.IgnitionDesigner$Handler.updateEditActions(IgnitionDesigner.java:2832)
at com.inductiveautomation.ignition.designer.IgnitionDesigner$Handler$SetEditActionHandler.run(IgnitionDesigner.java:3072)
at com.inductiveautomation.ignition.designer.IgnitionDesigner$Handler$4.actionPerformed(IgnitionDesigner.java:2214)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread “AWT-EventQueue-2” java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(Unknown Source)
at java.util.TimSort.mergeAt(Unknown Source)
at java.util.TimSort.mergeForceCollapse(Unknown Source)
at java.util.TimSort.sort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at sun.awt.datatransfer.DataTransferer.setToSortedDataFlavorArray(Unknown Source)
at sun.awt.datatransfer.DataTransferer.getFlavorsForFormatsAsArray(Unknown Source)
at sun.awt.datatransfer.SunClipboard.getAvailableDataFlavors(Unknown Source)
at com.inductiveautomation.ignition.designer.sqltags.dialog.TagBrowserPanel$TagBrowserActionHandler.canPaste(TagBrowserPanel.java:468)
at com.inductiveautomation.ignition.designer.IgnitionDesigner$Handler.updateEditActions(IgnitionDesigner.java:2832)
at com.inductiveautomation.ignition.designer.IgnitionDesigner$Handler.stateChanged(IgnitionDesigner.java:2838)
at com.inductiveautomation.ignition.designer.model.AbstractEditActionHandler.fireChangeEvent(AbstractEditActionHandler.java:37)
at com.inductiveautomation.ignition.designer.sqltags.dialog.TagBrowserPanel$TagBrowserActionHandler.valueChanged(TagBrowserPanel.java:453)
at javax.swing.JTree.fireValueChanged(Unknown Source)
at javax.swing.JTree$TreeSelectionRedirector.valueChanged(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(Unknown Source)
at javax.swing.JTree.setSelectionPath(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressedDND(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)