Script on change value tag

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.

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.

2 Likes

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 :wink:

Especially since it seems you have a lot of leds

2 Likes

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

Thank you!

It should also be noted that this:

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.

2 Likes