Expressions and Tag paths

I am trying to pass strings containing tag paths to a template for an expression binding on a custom property but am getting this error on my IF statement: Error_ExpressionEval(“If function got a null first argument”)

Code:

If(
tag({StartStopPanel.PREQ01}) && tag({StartStopPanel.PREQ02}),
3,
If(
tag({StartStopPanel.STT_RUN}),
1,
If(
tag({StartStopPanel.STP_RUN}),
2,
0
)
)
)

So each of these strings contain something like [default]PLC/BoolTag

Tag bindings of pretty much any kind get a null on startup while waiting for the subscription to deliver the first result. Where this is a problem, use the coalesce() or try() functions to transform that. Also, consider using indirect tag binding instead of the tag() function. See this:

1 Like

Thanks. I’ve resolved it by creating custom properties for each tag and using an indirect binding on each property, then using these properties in the expression. Was this what you were pointing towards?

Yes.