Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find Pi Point after create

Tags:

osisoft

I have C# application that creates a new Pi Point using the code based on  PI-AF-SDK-Basic-Samples/CreatePIPointsExample.cs at master · osisoft/PI-AF-SDK-Basic-Samples · GitHub 

The point seems to be created ok - here's a screen grab following a tag search in SMT:

enter image description here

My problem is, when my same C# application searches for the newly created Pi Point is doesn't find it. The code for the search is as follows:

       

private static List<PIPoint> GetPiPoints(PIServer piServer)
        {
            var criteria = GetCriteria("61");
            var foundPoints = PIPoint.FindPIPoints(piServer, criteria).ToList();

            criteria = GetCriteria("63");
            foundPoints.AddRange(PIPoint.FindPIPoints(piServer, criteria).ToList());


            criteria = GetCriteria("64");
            foundPoints.AddRange(PIPoint.FindPIPoints(piServer, criteria).ToList());


            return foundPoints;
        }

private static List<PIPointQuery> GetCriteria(string location)
        {
            List<PIPointQuery> criteria = new List<PIPointQuery>();

            PIPointQuery whereClause1 = new PIPointQuery(PICommonPointAttributes.Location1, OSIsoft.AF.Search.AFSearchOperator.Equal, location);
            PIPointQuery whereClause2 = new PIPointQuery(PICommonPointAttributes.PointSource, OSIsoft.AF.Search.AFSearchOperator.Equal, "o");

            criteria.Add(whereClause1);
            criteria.Add(whereClause2);

            return criteria;
        }

So, my understanding is that this should find all points that have a "location1" attribute value of 61, 63 or 61 AND a "pointSource" of "o" - I have tried uppercase and lower case "o"

From the screenshot, you can see that this is the case for the newly created "Kuba_99x" tag yet it is not found in the search, although thousands of other existing tags are.

Any ideas where I went wrong please?

like image 737
Rob Bowman Avatar asked Nov 25 '25 07:11

Rob Bowman


1 Answers

The Pi code was actually fine. Problem was, my code was filtering the newly created record after the selection.

like image 179
Rob Bowman Avatar answered Nov 28 '25 17:11

Rob Bowman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!