Binding Errors at Design Time

Hi there,

I have a question regarding bindings at design time. I saw a similar topic back in 2017 and I think this maybe along the same lines but there didn’t seem to be a definitive solution.

I have created vision templates which have a template parameter defined. This parameter is a UDT and I then bind various elements of the UDT to animate the template. So for example I have a circle which has an expression binding property on it which references the UDT. The syntax of the binding is as follows…

If (({AV.CW::AV_CW} = 1, color (255,255,0), color(25,0,0))

However, the designer throws the following error
Error executing expression binding on
AV.AV.Group 1.Polygon 2.fillPaint
caused by ExpressionException: Unsupported types for BAnd: ‘null’ and ‘java.lang.Integer’

At runtime no errors are generated but in the designer I have in excess of 200 errors due to bindings on various objects. Is the issue that at design time the object cannot bind to the runtime instance of the UDT? If so how do I stop the error occurring? Any help on the above would be gratefully appreciated.

Kind Regards
Kevin

couple your if statement with the try statements:

try(
    If(
        {AV.CW::AV_CW} = 1,
        color(255,255,0), 
        color(25,0,0)
    ),
    color(25,0,0) <-This is the color that will initially show up when the compare is still working on binding
)
2 Likes

Thank you ever so much, that worked great.

1 Like

Hi all, i was having a similar issue, just that my error message was:
caused by ExpressionException: Unsupported types for BAnd: ‘null’ and ‘null’

I have a button, and my display Text expression is:

if(({tag1} & !{tag2}), "PAUSED",
	if({Root Container.Other Button.indicatorValue}=1, "STARTED", "START")
)

I have tried the try() function, and it is working, not more error popup.

But i would like to know what is the root cause? As it is not really solving the issue, just “hiding” it…?

Should be two ampersands. A single is for bitwise AND, aka BAnd.

The root cause is that tag bindings in a Vision Client don’t have a value when they start–there’s a gateway round-trip that must happen at startup. Expressions must immediately return an answer, so tags are null or sometimes -1. The try() function is the simplest way to get past the problem.

1 Like

Hi Phil, thank you very much for the explanation!
Yes, there was a missing “&”.
I thought that it was something with my if() expressions, and hence kept troubleshooting in that direction.

Hi, does anyone else see a problem here ?
If there is a genuine bug with the expression, you might never be alerted to it because it gets caught by the try block!
Without the try block, exceptions will keep appearing in the designer letting you know there is a bug.

It does seem like a pretty bad way to bandaid it.
I also have been wondering lately, has the way “&” and “&&” been treated in expressions changed between 7.9 and 8.1? I am getting many more expression errors similar to this lately after the upgrade, where i never used to in 7.9.