Expression Try Tag not Found Failover

I have an expression on an INT tag in a UDT that is using binEnc() to combine some bits like so

binEnc(
{[.]1},
{[.]2},
try({[.]3},0),
try({[.]4},0),
try({[.]5},0),
try({[.]6},0)
)

In this instance, only 1 and 2 exist. So, shouldn't 3, 4, 5, and 6 fail over to 0? My tag throws an error, saying the tag is not found. Shouldn't that error failover?

Can you show the relevant UDT structure?

This is the INT with the expression.

image

If I use

binEnc(
{[.]1},
{[.]2},
if(isNull({[.]3}),0,{[.]3}),
if(isNull({[.]4}),0,{[.]4}),
if(isNull({[.]5}),0,{[.]5}),
if(isNull({[.]6}),0,{[.]6})
)

instead I get the result I want. I thought the try would behave the same and catch the null.

I don't know, but wouldn't an INT have all 32 bits defined?

1 Like

The rest would be 0 (implicit). Just combining these 6 into an INT (max 63) which can still be represented by a 32 bit

This is more readable

binEnc(
	{[.]1},
	{[.]2},
	coalesce({[.]3}),0),
	coalesce({[.]4}),0),
	coalesce({[.]5}),0),
	coalesce({[.]6}),0),
)
2 Likes

Ya, that's what I was trying to do with the try! Just using the wrong function.

Thanks!

1 Like