Perspective Event Driven Query Tag Expression

I’m using 8.1.18. I have a UDT with several query tags. I’d like to make them event driven so they only run when needed rather than pounding my database with a fixed rate execution. I have a tag that lets me know if we are running, which is also a UDT. I want the query tag to fire upon that tag changing. The status tag path is also a parameter of my UDT. So I’ve tried {STATUS_TAG_PATH}+“/VALUE” and tag({STATUS_TAG_PATH}+“/VALUE”) to no avail. I’ve also put these into an if statement. How do I get this to fire when this tag changes?

@jason.myers if it were me I’d put my queries into named queries (which return datasets) and then run them from a tag change script on the running status tag. As a UDT it might look something like this:


That’s a possibility, but just as a general question: how do you get an event driven tag to fire. Does anyone have an example?

That depends on what you mean by ‘event driven’ and ‘firing a tag’. If you mean based on a user interaction that’s one thing, based on when a client is currently using the tag value is another, and based on the value of another tag is yet another.

From your OP, I assume you mean based on the value of another tag. That would require configuring a drive tag group and adding any tags you want to executed based on that to that group.

Check out: Tag Groups - Ignition User Manual 8.1 - Ignition Documentation

Particularly the Driven and Leased Tag Group types.

As for “firing” as tag based on some user action, I don’t really know what you mean by “firing”. You could potentially use system.opc.readValue(s)() to read a value directly from a device without having a tag.

I suppose you could also set up a Driven Tag Group as a One Shot based on some memory tag that you have set up as the trigger and then write to the tag value on some user event to force a tag update.

Otherwise they only update their values based upon the Tag Group they are assigned to.

Someone needs to spend time with event driven tags.

They re-evaluate when any referenced tag within their expression/SQL changes.

1 Like

I rarely use Query Tags. But yes, I was not thinking about non-OPC tags. Good point.

From your original post I read you wanted the queries to trigger whenever the running value changes. If that is true, you just use the tag change script on that tag and it will fire whenever the value changes (ex: from True to False would cause the script to run).