Hello, I got this error, thanks everyone
Please click ‘Full’ and copy the entire stacktrace to the forum and post it here inside a preformatted text blocked:
```
stacktrace
```
java.lang.ClassCastException: Error trying to coerce 'Connected' to a number.
at com.inductiveautomation.ignition.common.TypeUtilities.toNumber(TypeUtilities.java:800)
at com.inductiveautomation.ignition.common.TypeUtilities.coerce(TypeUtilities.java:1146)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.setQValue(AbstractPropertyAdapter.java:223)
at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.setQValue(SimpleBoundTagAdapter.java:259)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(AbstractPropertyAdapter.java:269)
at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.notifyTagChanged(SimpleBoundTagAdapter.java:518)
at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.tagChanged(SimpleBoundTagAdapter.java:506)
at com.inductiveautomation.ignition.client.tags.impl.ClientTagSubscriptionManager$ListenerDeliveryManager.edtDeliver(ClientTagSubscriptionManager.java:603)
at java.desktop/java.awt.event.InvocationEvent.dispatch(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.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)
Ignition v8.1.11 (b2021101912)
Java: Azul Systems, Inc. 11.0.11
It looks like you have a numeric property of a Vision component bound to a tag with a string
value ("Connected"
). Vision has no concept of “transforms”, so you’ll probably want to switch to e.g. an expression binding, using the case
function:
https://docs.inductiveautomation.com/display/DOC81/case
case(
{path/to/tag},
"Connected", 1, // if value is "Connected", return 1
"Faulted", 2, // if value is "Faulted", return 2
0 // if no matched value, return 0
)
Great,thanks but after // the conditions are part of the code or just comments?
Those are comments.