Running the script after entering the values

Hello.
I need running the script after entering the values to the Numeric Text Field. I use Ignition 7.5.12. In the latest version ignition i know how to do it with tag change scripting.

Use a Gateway Tag Change Script.

The script works in the console but if I put to Gateway Tag Change Script it does not work

Did you save the project after you entered the script?

1 Like

Depending on where you put it in your gateway scripts, you may need to include the provider in all of your tag paths.

2 Likes

Be sure to use the tag provider, as other have said. If you are only doing this process in one spot, your script is perfectly okay (once the tag provider is added in). however, if you need to do this in multiple locations, then read on… :slight_smile:

Since all the tags are in the same folder, you can derive the parent path from the event’s tagPath and itemName. If you use the parent path in your script, that will do two things for you:

  • It will automatically keep track of the tag provider for you.
  • You won’t need any extra typing. You can just add the tag to monitor list.
# Get tag path and set parent path
# I don't think parentPath property was added 
# until later, but we can still calculate it.
tagPath = str(event.tagPath)
itemName = str(event.tagPath.itemName)
parentPath = tagPath[:-(len(itemName))]

PR_value = newValue.value
PR1_value = system.tag.read(path + 'KTP680Power').value

# Specify the tag paths
paths = [
			parentPath + 'KTP1Power',
			parentPath + 'KTP2Power',
			parentPath + 'KTP3Power',
			parentPath + 'KTP4Power'
        ]

# Specify the values
paths = [
			PR_value,
			PR_value,
			PR_value,
			PR1_value
        ]

system.tag.write(paths, values)
1 Like

Thanks, it worked