AnsweredAssumed Answered

PI Web API, PI Coresight and Event Frames

Question asked by andre.furtado on Mar 2, 2017
Latest reply on Mar 28, 2017 by rsun

Hello,

 

I'm trying to display on PI Coresight the last event of a Event Frame as a value symbol. I'm trying to achieve that through javascript by using a GET to this URL:

 

/piwebapi/eventframes/{database WebID}/eventframes?templateName=T%20Hi&sorfield=starttime&sortorder=descending&starttime=*-2d&searchmode=inclusive&maxcount=1

 

So I'm following this instructions (PI-Coresight-Custom-Symbols/tutorials/simplevalue at master · osisoft/PI-Coresight-Custom-Symbols · GitHub ) to create a symbol value symbol.

 

My question is on this part:

 

symbolVis.prototype.init = function (scope) {

   this.onDataUpdate = dataUpdate;

 

   function dataUpdate(data) {

   if(data) {

   scope.value = data.Value;

   scope.time = data.Time;

   if(data.Label) {

   scope.label = data.Label;

  }

  }

  }

};

 

This is where I get the data to the symbol, right? So for the scope argument I should use the GET from PI Web API?

 

Also, Can I use JQuery getJSON for the GET?

 

Is this the best way do it? Any help or insights would be appreciated!

 

Thank you!

Outcomes