Running Perspective Project Library script from event script ValueChange tag

I am trying to run a script from the project library. I have done this before on another project where I called the function by setting an event script (ValueChanged) on a tag. If the tag value (boolean) goes high I want to execute the function. For some reason I was able to do that on another project no problem. First project where it worked was version 8.0.14. This time I am using 8.1.1.

Due to not getting the script to work I simplified it to simply write something into the logs using system.util.getLogger command and I never get the message to appear on the logs. I know the script and the call to the script works because I put the same exact call to the function on the actual view regarding this tag, added a change script to the object bound to this tag, and put the same exact function call. I was going to leave it that way but now if you close the popup and then reopen it the script executes again if the value of the tag is still set to true so this will not work for my project.

Tag events can only call project scripts that are part of the Global Scripting project. Tags themselves are not in a project. Prior to v8, tag events could only call functions in shared scripts. In v8, that role is taken by the Global Scripting Project. Put the functions you wish to call from a tag event in your Global Scripting Project.

(The GSP is automatically created from the former shared scripts when upgrading. When starting from scratch in v8+, it doesn’t exist at all until explicitly designated.)

^ which is what I tried to explain here.

1 Like

Thanks all. Guess I still don’t get why it worked on 8.0.14 and I am doing the same exact thing on that project as far as where I am calling functions…etc. If you are saying it was changed when you get to version again 8…wouldn’t that mean my last project would not have worked?

After reading more in manual and looking at former project I know understand why it wasn’t working. The global scripting setting was still set to global and that is not the correct project I want to be directing everything to. I would need to change the of this setting to match. Thanks for the help!

1 Like

I think I’m experiencing the same issue. I’ve added the project name as the GSP but still, when I call the script from the project library I don’t get an error but a zero is being returned. If copy past the same value change script and test in the script console, it runs. Is there a chance I’m missing something? When does calling project library script return zero? TIA


Scope is not determined by where you put the script. Scope is determined by from where the script is called. If the caller is a tag event, the scope is “gateway global”, and the global scripting project is in scope. If the caller is one of a project’s gateway events, including tag change events and message handlers, the scope is “gateway project”, and that project’s scripts are in scope. If the caller is a Perspective action script, the scope is “Perspective session + gateway project”, and the project’s scripts are in scope along with some Perspective thread local objects. If the caller is a Vision client event or a Vision component event, the scope is “client project”, and the project’s scripts are in scope.

The designer is effectively an enhanced Vision client, so its script console follows that scope. (Sorta’ ish.)


Thanks for that detailed information, this is definitely something I can comeback for future references.

I have the value change script bound to the ‘data’ property of a time-series chart so I believe that project’s script should be in scope and that explains why I’m not getting a “Script not found” error. It’s just when I log the output of the call I’m seeing a zero value on the logs (which I guess is the only option for debugging). I think I must be missing something minute. I’ll keep poking around, thanks Phil!