AnsweredAssumed Answered

AFSDK - EventChange - RecordedValues - Concatenation

Question asked by aschauder on Mar 21, 2019
Latest reply on Mar 21, 2019 by aschauder

Hi the square,

 

As a starting point, I just want to specify that I never developed using AFSDK yet (but having a developper background).

Config: PI AF Server 2018

 

Here is the situation.

I'm facing a problematic that AF Analyses are not able to solve (I guess).

 

I have 13 tags in my PI Archive Server in scope of what I want to do.

These 13 tags are populated at the exact same time by information generated by equipments.

We often see that we have many records in each stored at the exact same millisecond.

 

For external reporting purposes, we need to concatenate the data stored at the same time in one single string.

 

1. I found the RecordedValues function in PI system Explorer which allows to retrieve in an array[] all the data stored using the following config:

 

     MyAttribute: PiPoint(MyTag)

      

     In Analyses tab:

     Trigger: Event-Triggered

     RecordValues(MyAttribute,'*','*');

 

2. To parse the generated Arrays, I've seen that only 2 functions exist: FirstValue() and LastValue().

    What I'd like to do is a loop to parse the 13 elements, on event change, and concatenate the values based on their position in the arrays (with the following logic):

 

MyRecordedValues1 = RecordValues(MyAttribute1,'*','*');

MyRecordedValues2 = RecordValues(MyAttribute2,'*','*');

MyRecordedValues3 = RecordValues(MyAttribute3,'*','*');

...

MyRecordedValues13 = RecordValues(MyAttribute13,'*','*');

 

For (n=0, n<ArrayLenght(MyRecordedValues1),n++){

     MyConcat = concat(MyRecordedValues1[n],MyRecordedValues2[n],MyRecordedValues3[n],...,MyRecordedValues13[n]);

     Store(MyConcat,MyConcatTag);

}

 

Any idea how I could to that ? Do I have to develop a service using AFSDK ? If yes, is the service able to execute the function on event-change ?

 

Thanks for your help !

Outcomes