Suggestion to improve tag change scripts

would it be possible to add functionality to use a sql query to build the tag list in the tag change script?

What I am after is the ability to add new tags to the tag change script without having to go into the designer. Is that even possible?

Just wanted to bump this up because I also thought that maybe it would be possible to add a scripting function that would be able to handle this instead of a sql query.

Another thought is a scripting function that would add the tag to the existing list of tags for a specified script name. for instance, my tag change script name is update tags. The scripting function would be something like system.gwTagChange.addTag(‘update tags’, ‘400001/lastpolltime’). Where the 2 variables that we pass are the name of the tag change script to update and the name of the tag to add.

Of course it would also be nice to have the option to delete a tag from the tag change scripts.

1 Like

Was something like this ever developed? or is there a workaround to accomplish the same goal?

No, nothing was ever developed for this.

It might be possible to configure a tag change script on a tag using system.tag.configure in Ignition 8.0 but I’d have to check with someone who knows for sure.

These are a bit different than the per-project Gateway Tag Change Scripts though.

@Kevin.Herron I was thinking about the GatewayTag Change Scripts, it would be great if we could dynamically add/remove tags.

Unfortunately, there is no way to modify the gateway tag change script from scripting, as they are project-specific resources. There is a way to modify a tag’s event script from a gateway script, here is an example. The example is assuming that a value change script already exists for a tag.

tags = system.tag.getConfiguration("[default]EventScriptTag")
tag = tags[0]
eventScripts = tag['eventScripts']

# Get the first event script. This is the value changed script
script = eventScripts[0]['script']
# Set the script text to anything you like, but you do need to add at least one \t for each line
script += "\n\tprint \"world\""
eventScripts[0]['script'] = script

# The base path is the folder where this tag is located
# Use 'o' to specify the overwrite collision policy
print system.tag.configure("[default]", tag, "o")