Scripting does not run


I am using Ignition 8.1.21.

My application is to use a PLC tag value change to trigger a scripting function to run. However it does not work. Even though I see the tag value is changed by the PLC, but the scripting does not run at all.

Can anyone have the scripting experience share some insights?



Where is the script located?
Can you share the script? When you do use the </> button in the forum editor to properly format the script.

Also, look in your gateway log to see if there are errors reported from when you first set it up (or restart the tag to make such errors show up again).

Please review the image below. When a button (bPrintLable_Raptor_OP200_PB) is pressed, I use the Value Changed to call the function DBInsertTest.NewLine(). Can you please review and let me know if anything is wrong here? Thanks.

So tag scripts are gateway scoped, and the gateway needs to know what project the script is in that you are calling. In the gateway way settings there is this setting:

Put your project name in there that holds the script. This is a gateway-wide setting.

You may want to re-think how you are doing that though. DB stuff in a tag script isn't the best.
Instead, use a Gateway Tag Event Script to do this: Gateway Events -> Tag Change. Then you won't have to set the scripting project.

1 Like

It works!
Thanks for the help.

I have another question. when a script line is very long, what is the best way to maintain the readability? Use a line continuation character? I tried "" to break long line but it does not seem work.

What do you mean? Can you provide an example?

Remember... use the </> option when posting code.

If a long, multi-line string constant, use python's triple-quoted constant format. If elements of a list or dictionary, you may break lines after the commas between elements without needing any line continuation mark.

1 Like

Thanks, guys. Great help.