Tag Expression containing 400 IfElse shows error even though within Max limit of Tag Expression

Hello,
this is my poorly written chain of IfElse conditions(I also tried in ternary operator)

https://smalldev.tools/share-bin/IjBFXr6C
screnshot:
delete.png

My text editor says: 402 lines 26802 characters, which is below the max limit mentioned here in the docs

The maximum length of an expression is 65535 characters.
If your expression approaches this limit, you should consider whether there might be a shorter way to write it.

But it is throwing error “Failed to compile expression”
But as i was cutting down some lines, to test max limits, I found a different error: Failed to compile expression. 16: Compiler recursion too deep

Can you not just scale this in a calculation tag - it looks like a linear scale?
You could then use another simple expression that limits the output to between 256 and 768, if desired.

1 Like

@TomE
Thanks for replying. You’re right, I really should break down the problem and look at it simply

a tag’s value is 10 at time=25sec. It linearly increases and becomes 15 at time=35sec.

Can you kindly suggest a tag expression ?
Much appreciated…

You can solve this one by using the correlations you have noted in the scaling tab when setting up the tag properties. If you do come accross non-linear tag scaling, you should use the following: https://www.vtscada.com/help/Content/Pro_Functions/TableInterpolation.htm