AddWithGUID Method (IPICampaignDB2 interface)

               

Adds a PICampaign object to the server PICampaignDB with an optional passed GUID. A PICampaign object is returned.

 

Syntax

object.AddWithGUID strCampaignID, StartTime, [EndTime], [varGUID]

The AddWithGUID method syntax has these parts:

Part

Description

object

An object expression that evaluates to a PICampaignDB object.

strCampaignID

A string containing the ID of new PICampaign

StartTime

A VARIANT representing the start time of the campaign. See Settings below.

EndTime

A VARIANT representing end time of campaign. [Optional] See Settings below.

varGUID

Optional VARIANT for the GUID for to the PIBatch being added.

 

Settings

The possible values in the variant for StartTime and EndTime are:

Setting

Description

VT_BSTR

A Variant containing a time/date string (currently in Microsoft formats)

VT_DATE

A Variant containing a DATE representing a local date on the current system

VT_R4,VT_R8,VT_I2, VT_I4

A Variant containing a number representing seconds since 1970 UTC.

VT_DISPATCH, VT_UNKNOWN

A Variant containing a reference to a PITime object

 

Remarks

WARNING: Using this interface improperly can cause data corruption on the Server. The GUID passed must not be the same as any other GUID used by the Server

Here are two Windows methods for properly creating a GUID:

CoCreateGuid (COM: unmanaged code)

System.Guid class (.NET)

 

PICampaign objects, as well as the time series batch objects PIBatch, PITransferRecord, and PIUnitBatch are stored in the PI Data Archive. Therefore creation requires that the target archive be the primary archive or the target archive was created after the installation of PI 3.3.

 

Trappable Errors

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

Error

Description

pseNOGENSERVER

The underlying server abstraction layer could not be accessed.

 

 

Enabling Operational Intelligence