Update another tag using a tag value changed script syntax question

I am running Ignition version 8.1.35.

I have two (2) tags in my tag provider:

CurrentTimeSeconds and New Tag

CurrentTimeSeconds updates once per second and is supposed to fire a value changed script by writing its value to another tag my tag provider (New Tag).

I'm sure I am missing something simple here but can't figure it out. The picture above shows the value changed script and the two (2) tags on the bottom left.

Any help identifying what I am doing wrong is appreciated.

Log the return value from writeBlocking().

Getting nothing.

This gateway is on a remote computer.

I repeated this experiment locally using Ignition 8.1.39 and I am getting a result (and the change script works).

On the remote computer running 8.1.35 I get nothing in the logs or the change script firing.

I am thinking to try a gateway stop / start and see what happens. Thoughts?

After you restart a tag, if there is a problem in a script, you should get a single error logged on that gateway. (And it typically says that further errors will be logged at DEBUG level.)

I restarted the tag on the remote computer running 8.1.35 and no new logs appeared. Last log was received about 10 minutes ago.

This error below has appeared periodically; not sure if related or not. There are a few developers working on this remote computer.

image

If the gateway has a gateway scripting project defined, consider moving the code to a library script. There, it is easier to wrap all of the logic in a dual-clause try-except-except for you to log.

You could also log a constant string just before the writeBlocking() to see if that comes through.

Could not get a gateway script work either.

Finally, did a gateway restart and logging started working again and my tag change script works.

This has happened twice (2x) to our team on 8.1.35 [for future reference].

No strange errors besides the one I posted that keeps happening periodically.

Maybe this is happening?

1 Like

I just started typing that....

My more modern advice, based on more knowledge, is that tag event scripts (on the tag) should run in single digits milliseconds, no exceptions. That means you cannot use any system.* functions that would wait on a database or wait on any network exchange. And never sleep or busy-wait. You cannot use system.tag.writeBlocking() on anything but memory tags. You cannot interact with the DB except via system.db.runSFPrepUpdate(). You cannot use system.opc.* at all. You cannot call out to any web API.

Tag Change Events defined in a project get their own thread, so can do more "bad" things.

5 Likes

How about system.tag.readBlocking()?

That one is always fine, as it just retrieves the most recently delivered value, practically instantly.

2 Likes