Result Property (PIAsynchStatus Object)



This read-write property is a Variant that contains a result of a call that was submitted with a PIAsynchStatus object.  If the call fails after being successfully placed (the initial call returned S_OK), the Result property will contain a PIError object giving information about the failure.  This is necessary as once the call has been submitted the caller no longer has an HRESULT to check yet the call may eventually fail due to server problems, invalid parameters, or local post processing issues.  Call failure is indicated by the Status property containing the csHasErrors bit.




The object placeholder is an object expression that evaluates to a PIAsynchStatus object.




When an asynchronous call is placed and returns, the output parameters of the call are initialized but generally empty.  For example, a PIData.RecordedValues call placed asynchronously will initially return S_OK as its HRESULT and an empty PIValues collection (Count is 0).  When the full asynchronous call actually completes the PIValues collection is filled with the results.  The Result property of the PIAsynchStatus object also contains a reference to the same returned PIValues collection.  This means the caller can use either reference for good results.  When an asynchronous method returns multiple results, the Result property will contain what is considered the primary result but other results must be obtained through the references returned with the original call.  The Result property is basically redundant when an asynchronous call succeeds but is critical for determining the cause of an error when an asynchronous call fails.

Enabling Operational Intelligence