RemoveValues Method (PIData object)

                    

 

Remove values at a time or over a range of times. If removing values at a single time is desired pass start and end time with the same value.

Both times must be supplied even if deleting values only at a single time is desired. This avoids misinterpreting a NULL second timestamp as current time and therefore allows one or multiple values to be removed with the same method.

Syntax

object.RemoveValues StartTime, Endtime, Behavior, AsyncStatus

The RemoveValues method syntax has these parts:

Part Description
object

An object expression that evaluates to a PIData object.

StartTime

A variant containing a timestamp for the beginning of the time range where values are to be removed.

Endtime

A variant containing a timestamp for the end of the time range where values are to be removed.

Behavior

A constant from the DataRemovalConstants enumeration to indicate how to handle multiple values at the same time.

AsyncStatus

Optional PIAsyncStatus object that may be used to monitor the progress and status of the method.

Settings

The settings for StartTime and EndTime are:

The settings for Behavior from the DataRemovalConstants enumeration are:

Setting Description
drRemoveFirstOnly Remove the first value at the same time. In the context of duplicate values at the same time, the first value removed will be the first written to the archive regardless of the order of StartTime and EndTime.
drRemoveAll Remove all values at the same time.

Remarks

This method removes either all or the first event when there are duplicate events at the same timestamp. To remove an event after the first event at a given timestamp the RemoveSpecifiedValues method should be used.

Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur:

Error Description
pseEVENTSUPDATE Failed to update events on the server. This indicates that server failed to complete the requested removal usually due to failure to connect.
pseFAILEDREMOVE Failed to remove one or more requested events. This indicates partial success.
pseARRAYREMOVE Unable to remove element from internal array.
pseOBJECTNOTPITIME A Variant passed for a time argument containing an object (IDispatch pointer) did not contain a PITime object or one of its derivatives.
pseVARIANTTYPEASTIME A Variant passed for a time argument did not contain a variant type that is supported.
tseTIMEINVALID Invalid time value.
pseVARIANTTIMETODOUBLE A variant passed for a timestamp could not be converted to a positive number of seconds since 1970.
pseDATETOTIMESTAMP A DATE passed for a timestamp could not be converted to a PI timestamp.

Enabling Operational Intelligence