# Unsupported types for BAnd: 'null' and 'java.lang.Long'

**URL:** <https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111>\
**Category:** Ignition\
**Tags:** vision, scripting, ignition81\
**Created:** [March 11, 2022, 2:41pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111 "2022-03-11T14:41:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brianw\_Wolowich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brianw_wolowich/32/32743_2.png) [@Brianw\_Wolowich](https://forum.inductiveautomation.com/u/Brianw_Wolowich)\
**Post date:** [March 11, 2022, 2:41pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/1 "2022-03-11T14:41:33Z")

</div>

I have a button visible binding code as:  
!((({Root Container.type} = 4) || ({Root Container.type} = 5)) && ({Root Container.bp.command} & 0x0080)) && !(!(({Root Container.type} = 4) || ({Root Container.type} = 5)) && ({Root Container.bp.command} & 0x0040))  
The code works correctly but when I open the popup window in designer I get an error message. If I set the single & to && then the error goes away but my logic fails.

What am I doing incorrectly? Any suggetions?  
FYI To shorten the code I would like to use ({Root Container.type} = (4 or 5)) but I cannot get that logic to work either.

---

<div class="post-metadata">

**Author:** ![Brianw\_Wolowich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brianw_wolowich/32/32743_2.png) [@Brianw\_Wolowich](https://forum.inductiveautomation.com/u/Brianw_Wolowich)\
**Post date:** [March 11, 2022, 2:53pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/2 "2022-03-11T14:53:02Z")

</div>

I did find this in another post. Can I use 'try()' in a binding?  
Or is this something I can just ignore as it only shows up in Designer?

> [@Binding Errors at Design Time](https://forum.inductiveautomation.com/t/binding-errors-at-design-time/34233/5):
>
> 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.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 11, 2022, 3:51pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/3 "2022-03-11T15:51:57Z")

</div>

You can use try().

The issue is indeed that {Root Container.bp.command} is null.

`&` and `&&` have different meanings. `&` is a bitwise AND operator. `&&` is a logical AND operator.

Unfortunately, the expression language does have a tendency to become very hard to read if care is not taken. There is also a lot of times where the use of a different expression will simplify the expression as well. On top of that, white space is not a factor so you can space out the expression to make it easier to read and follow.

```auto
try(

    !((({Root Container.type} = 4 || ({Root Container.type = 5)) && ({Root Container.bp.command} & 0x0080))
    &&
    !(!(({Root Container.type} = 4) || ({Root Container.type} = 5)) && ({Root Container.bp.command} & 0x0040))

,0)

```

What is the goal of the expression? There may be a better way to write it depending on what you are trying to accomplish.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 11, 2022, 4:00pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/4 "2022-03-11T16:00:01Z")

</div>

You could also chain transform in order not to repeat some parts of your expression.

---

<div class="post-metadata">

**Author:** ![Brianw\_Wolowich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brianw_wolowich/32/32743_2.png) [@Brianw\_Wolowich](https://forum.inductiveautomation.com/u/Brianw_Wolowich)\
**Post date:** [March 11, 2022, 4:03pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/5 "2022-03-11T16:03:09Z")

</div>

I have the same popup window for 7 types of motor equipment. I am passing a parameter named type to determine what graphics to display in the popup window. If the (type is 4 or 5) and the command is not 0x0040 or the type is not (4 or 5) and the command is 0x0080 then show this graphic.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 11, 2022, 4:12pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/6 "2022-03-11T16:12:20Z")

</div>

So this ?  
`((a or b) and not c) or (not(a or b) and d)`

Could this be simplified with an `if` ?  
`if (a or b, not c, d)`

my 1.5 months old daughter has been crying for 2 weeks straight so I might be too tired for this kind of logic, but...

> [@Brianw\_Wolowich](#):
>
> the command is 0x0080

Note that `&` is NOT `=`. If you're comparing for equality, use `=`.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 11, 2022, 4:44pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/7 "2022-03-11T16:44:06Z")

</div>

> [@pascal.fragnoud](#):
>
> Could this be simplified with an `if` ?  
> `if (a or b, not c, d)`

Yeah, I'm thinking something like:

```auto
if({Root Container.type} = 4 || {Root Container.type} = 5
    , !({Root Container.bp.command} = 0x0040) // Type is either 4 or 5
    , {Root Container.bp.command} = 0x0080 //Type is not 4 or 5
)

```

---

<div class="post-metadata">

**Author:** ![Brianw\_Wolowich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brianw_wolowich/32/32743_2.png) [@Brianw\_Wolowich](https://forum.inductiveautomation.com/u/Brianw_Wolowich)\
**Post date:** [March 11, 2022, 5:39pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/8 "2022-03-11T17:39:16Z")

</div>

I am going to show my ignorance here but I have never seen ‘,’ after an if statement  
I assume that the system reads it as (true/false statement, true comparison, false comparison)

Oh is this in the transform that pascal fragnoud mentioned?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 11, 2022, 5:43pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/9 "2022-03-11T17:43:37Z")

</div>

No, it’s an expression function.

```auto
if(conditional statement, true return, false return)

```

[https://docs.inductiveautomation.com/display/DOC81/if](https://docs.inductiveautomation.com/display/DOC81/if)

If the conditional statement is true the return the true return value, if it is false then return the false return value.

---

<div class="post-metadata">

**Author:** ![Brianw\_Wolowich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brianw_wolowich/32/32743_2.png) [@Brianw\_Wolowich](https://forum.inductiveautomation.com/u/Brianw_Wolowich)\
**Post date:** [March 11, 2022, 5:59pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/10 "2022-03-11T17:59:43Z")

</div>

Thank you so much, that is fantastic!

---

<div class="post-metadata">

**Author:** ![Brianw\_Wolowich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brianw_wolowich/32/32743_2.png) [@Brianw\_Wolowich](https://forum.inductiveautomation.com/u/Brianw_Wolowich)\
**Post date:** [March 11, 2022, 6:53pm UTC](https://forum.inductiveautomation.com/t/unsupported-types-for-band-null-and-java-lang-long/57111/11 "2022-03-11T18:53:48Z")

</div>

This is the code that works for me. I might have given you slightly wrong info but wanted to say thanks for helping me solve my difficulty!

! if ({Root Container.type} = 4 || {Root Container.type} = 5, {Root Container.bp.command} & 0x0080, {Root Container.bp.command} & 0x0040)

The graphic is not visible when ((type = 4 or 5) and (command & 0x0080)) or (not (type = 4 or 5) and (command & 0x0040))
