Strategy for handling AFListResults\<PIPoint, AFValue\>

Discussion created by tinklerj on Mar 7, 2013
Latest reply on Mar 24, 2013 by tinklerj

I am using the OSIsoft.AF.PI.PIPointList method RecordedValue()to retrieve values at a specific time (auto mode) for multiple tags.  This method returns an object of type OSIsoft.AF.AFListResults<PIPoint, AFValue> and I would like someone to check if my assumptions and handling of it are correct.  Let's call the returned variable "values".  Note that I pre-divide my tag lists so there is one PIPointList object per PIServer, although I know the method can handle multiple servers.


I ignore values.PISystemErrors since I am dealing only with PIServer objects.


If values.PIServerErrors (which is IDictionary<PIServer, Exception>) is non-null and non-empty, I assume the server is offline (whatever the exception) and stop further processing.


If values.Errors (type IDictionary<PIPoint, Exception>) is non-null and non-empty, I flag the corresponding tag as invalid and return a "Bad Input" type event for it.


If values.Results (type IList<AFValue>) is non-null and non-empty, I return the associated value to each tag (whether the value is bad or not).


My questions are:

  1. Is values.Count equal to values.Results.Count?  If not, then what?
  2. If a PIPoint in the PIPointList has a corresponding entry in values.Errors, does that mean it cannot have one in values.Results?  In other words (if pointList is my PIPointList object) does (pointList.Count == values.Results.Count + values.Errors.Count), assuming values.PIServerErrors is empty?
  3. I am assuming that entries in the Errors dictionary mean that the point or its data is not accessible, e.g. it does not exist, or the archive subsystem is not responding, or something serious like that.  Anyway, if all the points have Errors and none have Results, I assume that there is a bad problem with the server and abandon my calculations, to be retried later.  Is this reasonable?
  4. I am assuming that if the PIServerErrors dictionary has entries, there is no point checking Errors or Results.  Is this reasonable?
  5. If there is no archive event to be obtained (a condition which with good old PI-APi would return a -103 error) will this appear in Errors or as a No Data event in Results?

[I am having a bit of trouble with angle brackets, I hope they all come out correctly]