1 of 1 people found this helpful
Are you positive that the member at index 1 is a Secondary? It is not a gospel fact that the primary member is always index 0. I have a PICollective where the secondary is index 0 and the primary is at 1.
Thanks that was the issue the secondary was numbered 0. One more question in the code above how do I get a count of the Pionts in meter?
What does "count of PI Points in meter" exactly mean? Count of PI points with UOM meter? The length of the PI Point strings concatenated in font size 10?
The FindPIPoints returns an IEnumerable<PIPoint>, which does have a LINQ Count() extension . Better yet an IList<PIPoint> could have a Count property, so you would need to set this to a list. The quickest way is:
Meter = PIPoint.FindPIPoints(Ph3_PiSrv,criteria).ToList()
But it would probably be better to set that to an AFAttributeList. I'm rusty with VB.NET but it would be something like:
Meter = New AFAttributeList(PIPoint.FindPIPoints(Ph3_PiSrv,criteria))
I have used the PI SDK to connect to Pi Server; but the corresponding AF obbjects you can use.
PISDKObj = new PISDK.PISDK();
// Get the collective of the PI Server
myCollective = (IPICollective)PISDKObj.Servers[StrCollectiveName];
// Get the collective member list
serverlist = myCollective.ListMembers();
//Connect to the primary collective member
PiServerObj1 = myCollective.MemberOpen(serverlist, "PIUID=" + PI_User_ID + "Pwd=" + PI_password);
you can check the PIServerObj1 object properties to check which member its connecting to and then proceed with your further actions.
Did you have any more questions regarding this post, or have all of your questions been answered? Please feel free to continue this thread if you still have an outstanding question, otherwise please mark the most helpful answer as the 'correct answer'. Thank you!