RefreshToDepth Method (IRefresh2 interface)



This method retrieves state information from the server for the object from which it is called and updates the local cache of information in the PI-SDK.  The method acts hierarchically depending on the argument passed so a call to a particular object will also refresh that object's child objects to the depth specified if they have been cached.



object.RefreshToDepth  depth

The RefreshToDepth method syntax has these parts:




An object expression that evaluates to a reference to an IRefresh2 interface.  See the Applies To menu in the IRefresh2 definition (available from the "See Also" menu on this page) for a list of objects that support this interface.


An integer representing the depth in the PI-SDK hierarchy to which this call should apply.  See Settings below. 




The settings for depth are as follows:




Only the current object is refreshed.

1 - n

The current object and the next n levels of child objects are refreshed.


The current object and the entire child hierarchy should be refreshed (as in IRefresh.Refresh). 

< -1





Depending on the amount of cached data that has been retrieved by an application, refreshing an entire child hierarchy may be costly.  This method allows refreshing of higher level objects without the performance hit of also updating all child objects.  For example when another application updates the Known Servers Table and you wish to see that change reflected in your application you could call the Refresh method from the IRefresh interface retrieved from a Servers collection.  However, this could also refresh the Server's PIPoints collection, each retrieved PIPoint and their PointAttributes collections, the Server's StateSets, etc.  basically any child object that had already been retrieved.  By retrieving the IRefresh2 interface from the Servers collection and calling the RefreshToDepth method, passing 0 as the argument, only the list of Servers is updated, not its children.  

Enabling Operational Intelligence