# Error in Expression Binding

**URL:** <https://forum.inductiveautomation.com/t/error-in-expression-binding/35186>\
**Category:** Ignition\
**Created:** [May 30, 2020, 9:40pm UTC](https://forum.inductiveautomation.com/t/error-in-expression-binding/35186 "2020-05-30T21:40:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dghoskins](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@dghoskins](https://forum.inductiveautomation.com/u/dghoskins)\
**Post date:** [May 30, 2020, 9:40pm UTC](https://forum.inductiveautomation.com/t/error-in-expression-binding/35186/1 "2020-05-30T21:40:57Z")

</div>

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(TypeUtilities.java:1427)  
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.setQValue(AbstractPropertyAdapter.java:222)  
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(AbstractPropertyAdapter.java:264)  
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:89)  
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter$1.run(ExpressionPropertyAdapter.java:59)  
at com.inductiveautomation.ignition.client.util.EDTUtil$ProcessQueue.run(EDTUtil.java:127)  
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.0.12 (b2020042115)  
Java: Azul Systems, Inc. 11.0.6

Is there any way to eliminate the error messages?

Thanks,

Dennis Hoskins

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 31, 2020, 7:25am UTC](https://forum.inductiveautomation.com/t/error-in-expression-binding/35186/2 "2020-05-31T07:25:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [May 31, 2020, 11:33am UTC](https://forum.inductiveautomation.com/t/error-in-expression-binding/35186/3 "2020-05-31T11:33:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 31, 2020, 11:55am UTC](https://forum.inductiveautomation.com/t/error-in-expression-binding/35186/4 "2020-05-31T11:55:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dghoskins](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@dghoskins](https://forum.inductiveautomation.com/u/dghoskins)\
**Post date:** [May 31, 2020, 3:37pm UTC](https://forum.inductiveautomation.com/t/error-in-expression-binding/35186/5 "2020-05-31T15:37:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 31, 2020, 9:05pm UTC](https://forum.inductiveautomation.com/t/error-in-expression-binding/35186/6 "2020-05-31T21:05:57Z")

</div>

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