# Expression tag PLC reference

**URL:** <https://forum.inductiveautomation.com/t/expression-tag-plc-reference/104945>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 10, 2025, 12:21pm UTC](https://forum.inductiveautomation.com/t/expression-tag-plc-reference/104945 "2025-04-10T12:21:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anant\_Upadhyayula](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Anant\_Upadhyayula](https://forum.inductiveautomation.com/u/Anant_Upadhyayula)\
**Post date:** [April 10, 2025, 12:21pm UTC](https://forum.inductiveautomation.com/t/expression-tag-plc-reference/104945/1 "2025-04-10T12:21:45Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/d/4d12027d215745a047f6b0c3287ea41604d828d4.png)  
I inherited a system that as lot of scripting etc. One of tag was using switch. I was wondering is it possible to reference a PLC tag directly?  
Second is it a good approach ?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 10, 2025, 12:24pm UTC](https://forum.inductiveautomation.com/t/expression-tag-plc-reference/104945/2 "2025-04-10T12:24:10Z")

</div>

This is an expression, not scripting.

`{[.]Line}` is a tag reference.

You could replace `1` with similar syntax referencing some OPC tag.

You should probably do some reading or watch some IU videos re: expressions and scripting.

> **[Expression Language and Syntax | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/platform/expression-language-and-syntax)**
>
> Expression Language

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 10, 2025, 12:42pm UTC](https://forum.inductiveautomation.com/t/expression-tag-plc-reference/104945/3 "2025-04-10T12:42:08Z")

</div>

You could also convert them to [case | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/logic/case) statements which are a bit easier to read.

```python
case(
    {[.]Line},
    "LineA", 1,
    "LineB", 2,
    "LineC", 3,
    "LineD", 4,
    "-"
)

```

Note that the original expression is inconsistent. In one case it returns a string, "-" and in all the others it returns an integer. This is likely to cause problems elsewhere. (My expression does the same as it's merely a conversion from switch to case.)

Tip: for future code questions, please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).
