AnsweredAssumed Answered

PIPoint isResolved when using FindPIPoint

Question asked by langfom on Feb 14, 2017
Latest reply on Feb 17, 2017 by gregor

Hi There

I have written an application to insert data into PI from two sources.

The first source provides the Tag name so I am doing the following to retrieve the PI Point: -

PIPoint p = PIPoint.FindPIPoint(server, "my tag name");
if (p.IsResolved) {
     ...... process data ......
}

 

When using this method, isResolved returns true, so I can process my data into the PI Point.

 

My second source provides the PI ID so I am doing the following to retrieve the PI Point: -

PIPoint p = PIPoint.FindPIPoint(server, 1);
if (p.IsResolved) {
     ........ process data  ......
}

 

I have discovered during testing that the property isResolved doesn't return "true" when using the method

PIPoint.findPIPoint(PIServer, Int32)

 

Is this the intended behavior or a bug.  The documentation for the isResolved property of the PIPoint class says: -

 

IsResolved

This property is used to determine if the PIPoint's Name has been resolved.

Should my understanding of this be: -

1. when finding the point by the point's name, yes the name supplied into the method has been resolved to a PI Point.

2. when using a PI ID to find the point, a name is not being used to resolve the point so there is no need to set the isResolved property.

OR

Irrespective of which method is used, if a PI Point is returned, the isResolved property should be set and this is a bug?

 

My AFSDK assembly is v4.0.30319.

 

Here's a small test program to illustrate the behavior

 

using System;
using OSIsoft.AF.PI;

namespace PITest
{
    class Program
    {
        public void run()
        {
            var piServer = "MyServerHostName";

            PIServer server = PIServer.FindPIServer(piServer);
            PIPoint p1 = PIPoint.FindPIPoint(server, "sinusoid");
            Console.WriteLine("PIPoint by tagname Resolved?: " + p1.IsResolved);
            if (p1.IsResolved)
            {
                Console.WriteLine("\tPoint ID: " + p1.ID);
            }


            PIPoint p2 = PIPoint.FindPIPoint(server, 1);
            Console.WriteLine("PIPoint by PointNumber Resolved?: " + p2.IsResolved);
            Console.WriteLine("\tPoint Name is: " + p2.Name);
        }

        static void Main(string[] args)
        {
            Program p = new Program();
            p.run();
            Console.WriteLine("\n\nPress key to exit....");
            Console.ReadKey();
        }
    }
}

 

On my system, p2.isResolved returns false but ps.Name displays "SINUSOID".

 

Thanks

Outcomes