Method Reference C-D

C

Clear Method (DataCriteria Object)

Clears any previously supplied criteria for the DataRecordset query. Use this method to initialize the DataRecordset query.

Syntax

object.Clear

Parameters

None.

Returns

None.

Clear Method (DataFields Object)

Clears all DataFields from being returned in the DataRecordset query. Use this method to initialize the DataRecordset query.

Syntax

object.Clear

Parameters

None.

Returns

None.

Clear Method (Enumerated Sets Object)

Applies to:

Clears all the elements from the EnumeratedSets collection object and create a new instance of the EnumeratedSets collection.

Syntax

object.Clear

Parameters

None.

Returns

None.

Clear Method (EnumeratedStates Object)

Applies to:

Clears all the states from the enumerated set collection.

Syntax

object.Clear

Parameters

None.

Returns

None.

Clear Method (MessageCriteria Object)

Clears all previously supplied criteria for the MessageRecordset query. Use this method to initialize the MessageRecordset query.

Syntax

object.Clear

Parameters

None.

Returns

None.

Clear Method (MessageFields Object)

Clears all previously supplied criteria for the MessageRecordset query. Use this method to initialize the MessageRecordset query.

Syntax

object.Clear

Parameters

None.

Returns

None.

Clear Method (TagCriteria Object)

Clears previously entered criteria for the TagRecordset query. Use this method to initialize the TagRecordset query.

Syntax

object.Clear

Parameters

None.

Returns

None.

Clear Method (TagFields Object)

Clears all fields for retrieval in the TagRecordset query.

Syntax

object.Clear

Parameters

None.

Returns

None.

Returns

Clear Method (UserDefinedTypeFields Object)

Applies to:

Clears all the fields from the User Defined Type.

Syntax

object.Clear

Parameters

None.

Returns

None.

Returns

ClearRecordset Method (DataRecordset Object)

Clears specific records from the DataRecordset without deleting them from the Historian server.

You can specify a tagname to remove all DataValues for a specific tag, or supply a specific timestamp to remove a single DataValue.
CAUTION: You can clear the entire DataRecordset by omitting both the tagname and timestamp.

Syntax

object.ClearRecordset([Tagname], [TimeStamp])

Table 1. Parameters
Name Data Type Description
Tagname StringTag to clear records for (optional, read-only).
TimeStampDateTimestamp to clear records for (optional, read-only).

Returns

Boolean. Returns True if the ClearRecordset operation succeeded.

ClearRecordset Method (TagRecordset Object)

Clears specific records from the TagRecordset without deleting them from the Historian server. You can specify a tagname to delete a specific record.
CAUTION: You can clear the entire TagRecordset by omitting the tag name.

Syntax

object.ClearRecordset([Tagname])

Table 2. Parameters
Name Data Type Description
Tagname StringName of tag to remove from record set (read-only, optional).

Returns

Boolean. Success/Failure.

CloseAlarms Method (Alarms Object)

This function sends a special alarm request to close alarms on a specific collector before a specific date. This is useful to close out any alarms that are stuck mid-lifecycle.

Syntax

object.CloseAlarms(endDate, theCollector)

Table 3. Parameters
Name Data Type Description
endDate DateThe date from which to close alarms. Alarms before this date are closed.
theCollectorStringClose alarms associated with this collector/datasource.
Note: If your alarm collector is linked to a data collector, pass in the data collector name.

Returns

None.

CloseArchive Method (Archive Object)

Closes the specified archive for new data flow. You can perform this operation on the current archive only (the one accepting the newest data). Once an archive is closed, the Historian server looks to the next available empty archive to re-commence data storage.

If no empty archive is found, the method creates one or overwrites the oldest loaded archive. The archiving options, ArchiveAutomaticCreate, ArchiveAutomaticFreeSpace, ArchiveDefaultSize, and ArchiveOverWriteOld, control this behavior.

If ArchiveAutomaticCreate is running and enough free space exists on the drive of the ArchiveDefaultPath, the method creates a new archive of default size after it creates an archive of default size.

If the method cannot create a new archive, it overwrites the oldest archive based on ArchiveOverWriteOld being on. If ArchiveOverWriteOld is not on, the Historian archiver shuts down and the collectors start buffering data.

Syntax

object.CloseArchive(DataStoreName As String)

Table 4. Parameters
Name Data Type Description
DataStoreNameString The name of the data store the archive belongs to. This is an optional parameter.

Returns

Boolean. Returns whether or not the CloseArchive operation succeeded.

CollectorHasBackup Method (Collectors Object)

Returns whether a collector has a backup collector.

Syntax

object.CollectorHasBackup(CollectorName)

Table 5. Parameters
Name Data Type Description
CollectorName String Name of the collector to determine if a backup exists.

Returns

Boolean. True if the Collector has a backup, False otherwise.

Example
Dim MyCollectors As iHistorian_SDK.Collectors
Set MyCollectors = MyServer.Collectors
Dim HasBackup As Boolean
HasBackup = MyCollectors.CollectorHasBackup("SimulationCollector")

CommitImport Method (Alarms Object)

Writes the alarms/events acquired via the Import method to the Historian Archiver.

Syntax

object.CommitImport

Parameters

None

Returns

Boolean. Returns whether or not the Import operation succeeded.

Connect Method (Server Object)

Initiates a connection to the current server. Calling the Connect method on a currently connected session re-authenticates the user.

If a ServerName has been set, the method authenticates the user by the username and password supplied, if any. If they are not supplied, it authenticates the user by the currently authenticated domain user. If a ServerName has not been set, it uses the ServerName registered as the Default Server. If a username and password are not supplied, it uses the username and password registered with the default server. If neither establishes a username, it authenticates the user by the currently authenticated domain user.

Syntax

object.Connect([ServerName], [UserName], [Password])

Table 6. Parameters
Name Data Type Description
ServerName StringTable text
UserNameStringUsername to authenticate (optional).
PasswordStringPassword to authenticate (optional).

Returns

Boolean. Returns whether or not the Connect operation succeeded.

Example
Dim MyServer As New iHistorian_SDK.Server
' Connect to the default server using default user
If Not MyServer.Connect Then
err.Raise 1, , "Failed to authenticate on server " + MyServer.ServerName
End If
' Connect to the default server using specific user
If Not MyServer.Connect("Fred", "000") Then
err.Raise 1, , "Failed to authenticate on server " + MyServer.ServerName
End If
' Connect to specific server using specific user
If Not MyServer.Connect("USGB014", "Fred", "000") Then
err.Raise 1, , "Failed to authenticate on server " + MyServer.ServerName
End If

ConvertShortcutToTime Method (Server Object)

Converts a time shortcut to a date. It converts the time from UTC into formatted time based on the ConnectionOptions (TimeOption) settings listed below.

ValueDescription
(N)ow The current time (absolute).
(T)oday Today at midnight (absolute).
(Y)esterday Yesterday at midnight (absolute).
(D)aysNumber of Days (relative).
(M)in Number of Minutes (relative).
(H)our Number of Hours (relative).
(W)eek Number of Weeks (relative).
(BOM) Beginning of this month at Midnight (absolute).
(EOM)Last Day of this month at Midnight (absolute).
(BOY)First Day of this year at Midnight (absolute).
(EOY)Last Day of this year at Midnight (absolute).

Syntax

object.ConvertShortcutToTime(Shortcut)

Table 7. Parameters
Name Data Type Description
Shortcut StringDate of shortcut to convert (read-only).

Returns

Date. Returns date converted from string shortcut.

CopyTo Method (Tag Object)

Copies the properties of the given tag to the specified destination tag.

Syntax

object.CopyTo(TargetTag)

Table 8. Parameters
Name Data Type Description
TargetTag Variant The destination tag.

Returns

None.

CriteriaFromStrings Method (QueryModifiers Object)

Applies to:

Returns the sampling mode, calculation mode and query modifiers associated with the input CriteriaString.

Syntax

object.CriteriaFromStrings(CriteriaString As String)

Table 9. Parameters
Name Data Type Description
CriteriaString String Indicates the criteria string. For example, #ONLYGOOD.

Returns

DataCriteria

D

DataStoreUpdate Method (DataStores Object)

Updates the changes made to the data store settings.

Syntax

object.MyDataStores.Item(DataStoreName)

Table 10. Parameters
Name Data Type Description
DataStoreNameStringName of the data store that should be updated.
IsDefault BooleanIndicates whether the data store is the default data store.
Description StringDescription of the data store. This is an optional parameter.
StorageTypeStringIndicates whether the storage type is historical or SCADA buffer. This is an optional parameter.

Returns

Boolean. Returns TRUE if the data store has been updated and FALSE if there is an error in updating the data store.

Delete Method (Archive Object)

Deletes the specified archive on the Historian server. This is a synchronous operation that executes immediately when you call the Delete Method.

Syntax

object.Delete(DataStoreName As String)

Table 11. Parameters
Name Data Type Description
DataStoreName String Name of the data store that contains the archive. This is an optional parameter.

Returns

Boolean. Returns whether or not the Delete operation succeeded.

Delete Method (Archives Object)

Attempts to delete an Archive from the Historian server.

Syntax

object.Delete(ArchiveName As String, ArchiveDataStoreName As String)

Table 12. Parameters
Name Data Type Description
ArchiveName String Name of the archive to delete.
ArchiveDataStoreNameStringName of the archive data store the archive belongs to. This is an optional parameter.

Returns

Boolean. Returns whether or not the Delete operation succeeded.

Delete Method (Collector Object)

Deletes the specified collector on the Historian Server.
CAUTION: The default option also deletes all tags marked with this collector as their source (CollectorName Property) at the same time it deletes the collector.

Syntax

object.Delete([DeleteTags])

Table 13. Parameters
Name Data Type Description
DeleteTags Boolean Deletes collector tags when deleting the collector. (optional, default = True)

Returns

Boolean. Whether the Delete was successful.

Delete Method (Collectors Object)

Removes an existing collector with the specified name from the Historian server.

Syntax

object.Delete(CollectorName, [DeleteTags])

Table 14. Parameters
Name Data Type Description
CollectorName String Name of the collector to Delete.
DeleteTagsBooleanShould the tags from this collector be deleted as well?

Returns

Boolean. Success/Failure.

Example

Dim MyCollectors As iHistorian_SDK.Collectors 
Set MyCollectors = MyServer.Collectors 
MyCollectors.Delete "OPC Collector"

Delete Method (DataRecordset Object)

Marks the specified tag in the current TagRecordset for deletion. If the specified tag does not exist in the current TagRecordset, the method adds it. If the tag is not found, the Delete method fails.

In either case, the method does not delete this tag on the Historian server until the WriteRecordset Method of the TagRecordset object is called.

Syntax

object.Delete(Tagname, TimeStamp)

Table 15. Parameters
Name Data Type Description
Tagname String Name of the tag to delete (read-only).
TimeStamp DateTag timestamp (optional).

Returns

Boolean. Returns True if successful.

Delete Method (DataStores Object)

Deletes the data store.

Syntax

object.Delete(DataStoreName As String)

Table 16. Parameters
Name Data Type Description
DataStoreName StringIndicates the name of the data store that has to be deleted.

Returns

Boolean. Returns TRUE if the data store has been deleted and FALSE if there is an error in deleting the data store.

Delete Method (DataValue Object)

Deletes the DataValue from the archive. Commit the Delete operation by calling the WriteRecordset method of the DataRecordset object.

Syntax

object.Delete

Parameters

None

Returns

Boolean. Returns whether or not the Delete operation succeeded.

Delete Method (EnumeratedSets Object)

Deletes the specified set from the Historian Server. This is a synchronous operation that is executed immediately when you call the Delete method.

Syntax

object.Delete(setName)
Table 17. Parameters
NameData TypeDescription
SetName VariantThe name of the set that has to be deleted.

Returns

Boolean. Returns True if the method has been deleted

Delete Method (EnumeratedStates Object)

Deletes the specified state from the enumerated set. This is a synchronous operation that is executed immediately when you call the Delete method.

Syntax

object.Delete(StateName)

Table 18. Parameters
NameData TypeDescription
StateName VariantThe name of the state that has to be deleted.

Returns

Boolean. Returns True if the state has been deleted or False if not.

Delete Method (Tag Object)

Deletes the specified tag on the Historian Server. This is a synchronous operation that executes immediately when you call the Delete method. You can choose to delete a tag permanently from the Historian Server by passing an additional parameter as True or False.
Note: This method is called within the WriteRecordset method. For more information, refer to the Sample Code section.

Syntax

object.Delete((Optional) DeletePermanent)

Table 19. Parameters
Name Data Type Description
DeletePermanent Boolean (Optional) Pass TRUE to permanently delete a tag.

Returns

Boolean. Returns whether or not the Delete operation succeeded.

Delete Method (TagRecordset Object)

Marks the specified tag in the current TagRecordset for deletion. If the specified tag does not exist in the current TagRecordset, the method adds it. If the tag is not found, the Delete method fails. In either case, the method does not delete this tag on the Historian server until the WriteRecordset method of the TagRecordset object is called.

Syntax

object.Delete(Tagname)

Table 20. Parameters
Name Data Type Description
TagnameStringName of the tag to delete (read-only).

Returns

Boolean. Returns whether or not the Delete operation succeeded.

Delete Method (UserDefinedTypeFields Object)

Deletes a field from the User Defined Type. This is a synchronous operation that is executed immediately when you call the Delete method.

Syntax

object.Delete(FieldName)

Table 21. Parameters
Name Data Type Description
FieldName VariantThe name of the state that has to be deleted.

Returns

Boolean. Returns TRUE if the state has been deleted.

DeleteEx Method (Archive Object)

Deletes the specified archive on the Historian server. This is a synchronous operation that executes immediately when you call the Delete Method. The window associated with the handle passed in is kept alive (messages processed) while the operation takes place.

Syntax

object.DeleteEx(hWnd As Long, DataStoreName As String)

Table 22. Parameters
Name Data Type Description
hWnd LongThe handle of the window to keep alive.
DataStoreNameStringName of the data store that contains the archive. This is an optional parameter.

Returns

Boolean. Returns whether or not the Delete operation succeeded.

DeleteEx Method (Archives Object)

Attempts to delete an Archive from the Historian server. Keeps the window with handle hwnd alive by processing its messages while waiting for the deletion to occur.

Syntax

object.DeleteEx(ArchiveName As String, hWnd As Long, ArchiveDataStoreName As String)

Table 23. Parameters
Name Data Type Description
ArchiveNameString Name of the archive to delete
hWndLongThe window handle to keep alive.
ArchiveDataStoreNameStringName of the archive data store the archive belongs to. This is an optional parameter.

Returns

Boolean. Success/Failure.

Disconnect Method (Server Object)

Disconnects the currently authenticated connection to the Server.

Syntax

object.Disconnect

Parameters

None

Returns

None.