# Expression Tag that Writes to OPC Address (PLC)

**URL:** <https://forum.inductiveautomation.com/t/expression-tag-that-writes-to-opc-address-plc/43614>\
**Category:** Ignition\
**Created:** [February 19, 2021, 1:25pm UTC](https://forum.inductiveautomation.com/t/expression-tag-that-writes-to-opc-address-plc/43614 "2021-02-19T13:25:21Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 19, 2021, 3:28pm UTC](https://forum.inductiveautomation.com/t/expression-tag-that-writes-to-opc-address-plc/43614/12 "2021-02-19T15:28:24Z")

</div>

Also, diffSetpoint is not defined, so you’ll need to either assign a value, or hard code a value

```auto
diffSetpoint = 100
if newValue.getValue() > diffSetpoint:

```

or

```auto
if newValue.getValue() > 100:

```

Edit: just thinking through this a bit. If the tag that is triggering this event is an expression tag which results in a bool value then your script can be simplified

if you only want to write to the tag on a true value:

```auto
if newValue.getValue():
    system.tag.writeBlocking(['[default]_Rkn031_900_/Atomizer/Atomizer_Open'],[newValue.getValue()])

```

if you want it to write for both then omit the if statement

```auto
system.tag.writeBlocking(['[default]_Rkn031_900_/Atomizer/Atomizer_Open'],[newValue.getValue()])

```

If the tag is a numeric value then you’ll need what you have.

---

_[View the full topic](https://forum.inductiveautomation.com/t/expression-tag-that-writes-to-opc-address-plc/43614)._
