1 of 1 people found this helpful
From our documentation for the PI SDK and the summaries method, it says that the Value property of the NamedValues object contains the PIValues object. Here is my example:
Set namedVals = pt.Data.Summaries(startTime, endTime, btAuto, asAverage) 'namedVals is a NamedValues object
Set piVals = namedVals("Average").Value 'piVals is a PIValues object
Let me know if this helps!
Here is the documentation that I referenced: https://techsupport.osisoft.com/Documentation/PI-SDK/PI_SDK_Interfaces/PI-SDK_Objects/PIData/IDH_DAT_SUMMARIES.htm
You'll want to scroll down to the end of the page. The PI SDK documentation is also available in %PIHOME64%\help\en\pisdk.chm.
This worked well! I didn't realize on the SDK documentation that if you scrolled all the way to the bottom there were additional frames that contained more content.
While it works, I'm still a bit confused why the NamedValues object that is returned requires a parameter ("Average") which was specified in the Data.Summaries call as a parameter (asAverage), Does the NamedValues object contain a set of PIValues objects for each calculation (e.g. Min, Max, Average, etc.)?
2 of 2 people found this helpful
I think these lines from the PI SDK documentation would help address your confusion:
"The Summaries2 method retrieves several summary types in a single call over the specified range, and for each interval within the range. The method returns a NamedValues collection which contains named summaries as PIValues... The summaries methods can compute multiple summary results over multiple calculation periods. The summaries methods return the result as a NamedValues collection. Each requested summary type produce a corresponding NamedValue item in the NamedValues collection. The name property of the NamedValue item contains the string representing the summary type. The following table shows the string corresponding to each summary type. SummariesType like asAll or asTotalAndAvg will result in NamedValues collection with more than one item."
So yes, the NamedValues collection could contain more than 1 summary type which is why you would be required to specify it again when accessing the Value property.
Thank you - I read that first pass but it was semi-gibberish to me. Second pass with your guidance helped make it clear!