Project Functions

Project functions allow you to access project information with script / expression. In the inSCADA Platform, besides the project information, we are able to keep a number of parameters specific to our application statically for the project. With these static parameters, we can ensure that our applications are more general and dynamic. See Project Properties.

Get Project

object ins.getProject()

Reads the project information.

Syntax

function getProjectProp(id,prop) {
var prj=ins.getProject();
var properties=JSON.parse(prj.properties);
var streams=JSON.parse(properties.STREAMS);
if (prop==="STREAM_NUMBER") {
    var counter=0;
    for (var i=0;i<streams.length;i++) {
         if (streams[i].id.substring(22,24)!=="00") {
         var prefix1=streams[i].id.substring(0,22);
         var prefix2=id.substring(0,22);
         if (prefix1==prefix2) counter=counter+1;
         }
    }
    return counter;
}
else 
{
    for (var z=0;z<streams.length;z++) {
         if (streams[z].id==id) return streams[z][prop];
    }
}
return "NOTOK";
}

getProjectProp("STN01_GRP01_PAY_STREAM01","STREAM_NUMBER");

Last updated