Error in Expression Binding

Hi, I am making a template for a pump on a VFD. I have a template parameter VFDTag which I use in expression bindings. Most work fine, however I need to change the color of the Fill Paint for several shapes based on the status of a “Running” tag. I am using the following expression:

if((tag(’[default]Pumps/VFD’ + {VFD.VFDTag} + ‘/Running’)),color(255,250,250),color(155,140,140))

The expression changes the Fill Paint color but I also get (2) repeated error messages:

java.lang.ClassCastException: Cannot coerce value ‘true’ into type: interface java.awt.Paint
at com.inductiveautomation.ignition.common.TypeUtilities.coerce(
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.setQValue(
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter$
at com.inductiveautomation.ignition.client.util.EDTUtil$
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$ Source)
at java.desktop/java.awt.EventQueue$ Source)
at java.base/ Method)
at java.base/$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/ Source)

Ignition v8.0.12 (b2020042115)
Java: Azul Systems, Inc. 11.0.6

Is there any way to eliminate the error messages?


Dennis Hoskins

Considering you’re not using tags for your colours, you can just use an indirect binding and select your colours instead from the colour pickers

Also if possible using the hex string instead of the color() expression may solve this too

I’ve only ever had issues using color(...) if i’m trying to use it in combination with strings (e.g. HEX, or even just the RGB values as a string). The expression language doesn’t handle type-casting, I think it grabs the data type from the first return value (in an if, that would be the true value) and expects that data type for all return values


Thank you nminchin, that worked although I think my original approach should have also worked.

1 Like

Yes, it should have worked, not sure why you were getting errors :thinking: