# Script on change value tag

**URL:** <https://forum.inductiveautomation.com/t/script-on-change-value-tag/95848>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [September 11, 2024, 1:31pm UTC](https://forum.inductiveautomation.com/t/script-on-change-value-tag/95848 "2024-09-11T13:31:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cesar\_Felipe](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@Cesar\_Felipe](https://forum.inductiveautomation.com/u/Cesar_Felipe)\
**Post date:** [September 11, 2024, 1:31pm UTC](https://forum.inductiveautomation.com/t/script-on-change-value-tag/95848/1 "2024-09-11T13:31:50Z")

</div>

I inserted a script into the value change property of a tag but it appears that this script is not being executed as the tag value changes.

Whenever the value changes, I will check the status of other tags and change the background of a table cell.

I would like to know if I did something wrong or failed to do something?

I'm using Perspective.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/6939df7ab036b65722e4d56029f21b8f497aeae1.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 11, 2024, 1:36pm UTC](https://forum.inductiveautomation.com/t/script-on-change-value-tag/95848/2 "2024-09-11T13:36:40Z")

</div>

> [@Cesar\_Felipe](#):
>
> did something wrong

Yes, tags don't have a `self` or have any connection to any Perspective components.

If you do need to do something in a UI based on a tag value, put the logic in the UI, not on the tag.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [September 11, 2024, 1:46pm UTC](https://forum.inductiveautomation.com/t/script-on-change-value-tag/95848/3 "2024-09-11T13:46:53Z")

</div>

In the view where you have this "Protector" component, you will have to put a custom property reading the led tag. There you can handle the colors

Also this seems to be repeating some things, try to make it a bit more generic 😉

Especially since it seems you have a lot of leds

---

<div class="post-metadata">

**Author:** ![Cesar\_Felipe](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@Cesar\_Felipe](https://forum.inductiveautomation.com/u/Cesar_Felipe)\
**Post date:** [September 11, 2024, 2:26pm UTC](https://forum.inductiveautomation.com/t/script-on-change-value-tag/95848/4 "2024-09-11T14:26:17Z")

</div>

This makes sense. I will use my script in the UI.

Thank you!

---

<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:** [September 11, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/script-on-change-value-tag/95848/5 "2024-09-11T15:08:22Z")

</div>

It should also be noted that this:

```python
if "[.]Led1" == 1:

```

Will never be true, as you are comparing a string to an integer.

Just typing the path into the script will not read the value of the tag. You need to call `system.tag.read*()`

Honestly, you should at the very least add custom props to bind each of the Led tags too.
