I have been trying, without any luck, to implement running scripts on Ignition Edge with the runScript function.
A special licence was purchased which should have allowed me to do this on Ignition Edge:
I have set up a few scripts that I need to run from different tags in the shared script folder on the edge gateway:
And here is one expression tag that uses the runScript function to call the appropriate script:
No matter what I do I’m always getting the following error:
Can anybody see what I’m doing wrong.
Thanks, all help is greatly appreciated.
Hmm. Everything looks right. Maybe this is a bug? Have you been in contact with support?
That is encouraging news in the sense that I have done things right on my end.
To answer your question, no I have not contacted support.
I guess I will have to create a support ticket next.
Thanks for your help.
Yikes. I’ve been able to reproduce this and I’ve made a ticket to fix it. When you file the support ticket let them know I’m working on it so they can link my ticket to yours.
His this been fixed on Edge? I’m using 8.1.4 and still get “Error_ExpressionEval” on any tag that uses runScript. These same expressions were used on Ignition without issues. I even confirmed I can call the functions in the Script Console and they work fine there. But when calling them from a tag it doesn’t work. Any ideas?
Hey David, to be honest I have no idea if this has been fixed or not.
I can tell you that I did not get it working on my end.
I had multiple instances of back on forth with Inductive Support trying to fix multiple issues.
Since it was not that important and there are far more important things that I can be doing than troubleshooting something that should be working from the get go I decided to drop the matter.
Apparently so did Inductive Automation since my support ticket vanished into thin air .
What I can tell you is that you definitely need the Web Developer module and you need to set the Gateway Scripting Project parameter under Gateway Settings to get things going.
This should have been fixed as of 8.1.1. As Nikola mentioned, you do need the gateway scripting project to be set to the Edge project. The other thing is that the Edge Compute license does need to be enabled before this functionality works (it’s one of the only places that does not work in trial mode. This is eventually going to be changed).
Thank you. This answers the issue. I am indeed currently in trial mode but should be activating the license today to see this get resolved. Also, I do remember that option on the gateway where you specify the project for gateway scripting. I went ahead and pointed it to Edge thinking that was the problem at first. I do find it strange that this needs to be set since Edge only allows for one project anyways. Maybe this should be implied and not have the option in the first place.
Yes, I figured we needed the “Compute” module to get scripts working so we did purchase that. Thanks.
David, I would love to hear how things go once you license the Edge Gateway.
I had a few moments to think yesterday and I remembered a bit more about the whole thing.
osolorzano was right in that there was a bug fix and we were able to run scripts with the runScript expression function, the problem we had was when trying to pass parameters into the script.
When running a simple script without passing parameters there were no error but for the life of me I could not figure out how to successfully pass parameters into the script without getting the "Error_ExpressionEval”.
I would love to hear how things go on your end.
I believe the thinking behind having the gateway scripting project option not infer the Edge project is because it is possible to have multiple projects in Edge in the situation where you upgrade/gwbk restore from pre-8.x which will give the gateway a “global” project as well as the Edge project. Although, it would be nice if it inferred it was Edge on a new install. I see no harm in making a ticket for that, so I will go ahead and write that up.
As for passing parameters in a runScript expression, I’ve run into similar issues and will defer to the user manual page on it. Specifically under examples where it says “Passing Arguments”. Looking at the “Preferred syntax” example, there’s a couple things to keep in mind:
- Use the path of the script’s function without the () symbols, the expression function is expecting just the actual function
- The very next argument is the Poll Rate, not the first passed in argument.
- Only after the poll rate can you start a comma delimited list of arguments you actually want to pass in.