AnsweredAssumed Answered

How to get element name from attribute using AFDataPipe?

Question asked by PraveenCTS on Dec 4, 2015
Latest reply on Dec 4, 2015 by PraveenCTS

Hi all,

 

I am trying out a sample based on AFDataPipe from this link How to use the PIDataPipe or the AFDataPipe . And i am able to subscribe to the tags that i want to monitor. Also i am able to get the change data as well. Below is a code sample:

private void AfDataPipeTask(IList<AFAttribute> attributes, int dataUpdateIntervall)

        {

            using (var afDataPipe = new AFDataPipe())

            {

                afDataPipe.AddSignups(attributes);

 

 

 

 

                while (_canContinue) // this statement keepes the task (thread) alive

                {

                    bool bMoreEvents = true;

                    while (bMoreEvents) // we need this loop to be certain that we empty the data pipe each time we come...

                    {

                        var results = afDataPipe.GetUpdateEvents(out bMoreEvents);

                        foreach (var dataPipeEvent in results.Results)

                        {

                            Console.WriteLine("AFDataPipe event - Attribute Name: {0}, Action Type: {1}, Value {2}, TimeStamp: {3}", dataPipeEvent.Value.Attribute.Name, dataPipeEvent.Action.ToString(), dataPipeEvent.Value.Value, dataPipeEvent.Value.Timestamp.ToString());

                        }

                    }

 

 

 

 

                    Thread.Sleep(dataUpdateIntervall); // this helps reducing CPU consumption and network calls to PI to check the Pipe.

                }

            }

        }

 

In the above piece of code i am trying to print different attribute informations.

What i want to get now is, i want to get the element name to which this attribute belongs and want to print the element name along with other attribute informations?

How can i do this?

 

Looking forward to your solutions.. thanks in advance.

Outcomes