I get an error if I set the tag to itself in the false case.
Seems really odd that in an expression tag logical IF, the false case is required.
But yah, in the script, I say if x write y to z
I don’t like that the script has to be on the raw data side rather than the tag that I am working on.
If someone wants to back-trace where it is written from, they have to check all the other spots.
Hmmm… yeah expression tags don’t let you do that. It does work partly but you can’t change the value of the expression tag directly. Jordan’s answer is the correct way.
Why would you expect the latter to work?
Ignition’s expression language must return a value, by definition. An if with no else is an incomplete statement.
In a derived tag, you could use if({otherTag} < 1000, {value}, {source}) to discard incoming writes based on some other tag.
However, if that’s what your actual expression is, then it really seems like you might just need clamping and/or scaling: Tag Scaling Properties - Ignition User Manual 8.1 - Ignition Documentation
Derived tags are ‘special’, and set up the read and write expressions with some context (specifically to avoid the problem/limitation of the expression language).
I am an electrical engineer. Forgive me. I took programming for non-believers.
edit
I meant to excuse myself and be honest about not knowing that “Expression Language” was a whole subset of programming languages. I thought it was another programming language unto itself, and as unique as Java, Codesys, or Python. I had thought someone had decided to make Expression Language that certain way.