Case expression binded on coordinates(x,y,deg) for symbol transposition


I have trouble with creating a case expression. Simply I want to assign a script in a symbol to change its coordinates to begin with(starting with y position expression binded) based in Tags variation(integers or Bools) read from the PLC. So my current expression looks like :

1,if({[default]Tags/MOT/R0198} > 0 ,200,0),
2,if({[default]Tags/MOT/R0199} > 0 ,300,0),

I want to assign up to 500 tags lets say. Would that be efficient first of all?

The error I am getting isCycleErrorDetected at the moment which I believe I am missing something on the syntax?

So I want to say if this Tag is >0 write to y(binded expression) 200, otherwise go to 0 position.

Then I would like to do the same for x positions as well as angles(in case I want my component to have an angle based on the position it needs to go, so I could also play with visibility and use 1 symbol instead of 500 lets say symbols with alocated tags read from the PLC.

Would this be an efficient way of automating repetitive work or would I utilise too much CPU let’s say.

Any thoughts?

Thank you in advance

I would not do this with an expression, or at least not an expression in the context of a single Perspective session.

I would do this via a script called in a single tag (probably an expression tag using runScript). For best performance, your function should issue a single readAllBlocking call at the beginning of execution.
I would have this function (and therefore tag) hold a dataset with the properties you need for display on the actual session, e.g. x, y, and rotation. Then I’d use a view canvas to actually render the graphics.

The way you’re going, you’re going to have ~500 tag reads (expressions are not generally lazily-evaluated) issued for every change to any of the tags, multiplied by every session you have open.