Troubleshoot JavaScript in SCADA

We highly recommend JavaScript as your scripting language despite Ecava IGX do support VB Script for awhile now. As compare to VB Script, JavaScript is the language of the web and for the future. JavaScript is powerful and flexible, but flexibility itself has pros and cons. JavaScript is very linient on syntax, for example it’s OK to skip semicolon at the end of each line, but this flexibility itself might cause you trouble in future.

So it’s good to check out some good practices in the market, like Google Guidelines. They may help you to reduce your chance of making mistakes and hence reducing your troubleshooting time. You don’t have to follow them all, but you must understand what’s the reason behind if you choose to go against them.

One tool that worth take a look is http://jshint.com/. If you copy paste a JavaScript code from a typical IGX project into JsHint, you should only see two undefined variables: that’s getTag() and setTag(). Otherwise it would be any debugging functions like debugTag() and debugString(). You can see the highlighted functions when you mouseover on the warnings.

Yes, in case you haven’t known, do checkout debugTag and debugString which are two debugging functions that we created to ease your troubleshooting work. Just remember to click on Debug button to turn on Debugging mode from Server, and you shall see pink text being logged in Script task.

One simple step to narrow down any of your troubleshooting scope is to start new and do small.