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

**URL:** <https://forum.inductiveautomation.com/t/case-expression-binded-on-coordinates-x-y-deg-for-symbol-transposition/53234>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 18, 2021, 11:08am UTC](https://forum.inductiveautomation.com/t/case-expression-binded-on-coordinates-x-y-deg-for-symbol-transposition/53234 "2021-11-18T11:08:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [November 18, 2021, 11:08am UTC](https://forum.inductiveautomation.com/t/case-expression-binded-on-coordinates-x-y-deg-for-symbol-transposition/53234/1 "2021-11-18T11:08:26Z")

</div>

Hi,

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 :

```auto
case({this.position.y},
1,if({[default]Tags/MOT/R0198} > 0 ,200,0),
2,if({[default]Tags/MOT/R0199} > 0 ,300,0),
0)

```

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

The error I am getting is`CycleErrorDetected` 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

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 18, 2021, 3:30pm UTC](https://forum.inductiveautomation.com/t/case-expression-binded-on-coordinates-x-y-deg-for-symbol-transposition/53234/2 "2021-11-18T15:30:48Z")

</div>

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.
