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:
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?
The Pi code was actually fine. Problem was, my code was filtering the newly created record after the selection.