IAFVersionable.ApplyQueryDate Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
IAFVersionable ApplyQueryDate( Object queryDate )
Function ApplyQueryDate ( queryDate As Object ) As IAFVersionable Dim instance As IAFVersionable Dim queryDate As Object Dim returnValue As IAFVersionable returnValue = instance.ApplyQueryDate(queryDate)
IAFVersionable^ ApplyQueryDate( Object^ queryDate )
abstract ApplyQueryDate : queryDate : Object -> IAFVersionable
Parameters
- queryDate
- Type: SystemObject
The new value for the QueryDate. A value of or AFTime.MaxValue initializes the query date so the latest versions of sub-objects are retrieved. The value may be an AFTime, DateTime, PITime, String, or numeric. A DateTime (or a DATE will be treated as UTC time if its Kind property is set to Unspecified. Because DATE values from COM or VB6 clients are marshalled as Unspecified, these client applications must convert to UTC prior to marshalling. An integer numeric represents the number of ticks (100-nanosecond intervals) since January 1, 0001. A floating point numeric represents the number of seconds since January 1, 1970 UTC. A String is interpreted as local time, unless it contains a time zone indicator such as a trailing "Z" or "GMT". Strings will be interpreted with the AFTime.Parse Overload methods so that relative formats with intervals ("*", "T+3h", etc.) are also supported. Relative time intervals are based on AFTime.Now.
Return Value
Type: IAFVersionableReturns the version of the object for the specified QueryDate.
Remarks
The returned object will have its QueryDate property set to the specified queryDate parameter value. The QueryDate is used to retrieve version of objects from the AFDatabase. The version of the object used to do the retrieval is the one in effect or the QueryDate. The returned sub-collection of the object are the ones in effect for this date.
This property defaults to current time. However, once it is set, any object retrieve from one of its sub-collections will have their QueryDate's set to this object's QueryDate. Changing the QueryDate does not affect this object.
This date is a short cut for obtaining the desired versions of the subordinate objects. Set it to a time that makes sense for your application. For example, when getting the equipment for a AFElement, set it to the end time of the desired time period. Then the versions of the subordinate objects retrieved will have their effective dates at or before the end time of the element.
Use the PISystem.Supports method to check if the PISystem supports the Versioning feature.