ArchiveValues

 

Remarks Properties Methods Samples

ED
not used
RT
avaliable

Remarks:Top

The "ArchiveValues" object manages the "ArchiveValue" objects.

This object is utilized by the "ArchiveFilterVariable" object, in order to access the collection of "ArchiveValue" objects.

Properties:Top

Count Parent  

Methods:Top

CreateArchiveValue DeleteArchiveValue Item

Samples:Top

Sub zenOn_ArchiveValues(ByRef zArvFilterVar As ArchiveFilterVariable)
	'Declarations
	Dim zArvValues As ArchiveValues
	Dim zArvValue As ArchiveValue
	Dim zTimeConvert As clsTimeConvert
	Dim i As Integer

	'Initialize zArvValue with the archive values collection of the current archive variable
	Set zArvValues = zArvFilterVar.ArchiveValues

	'Initialize zTimeConvert by creating a new instance of the zenOn "clsTimeConvert" macro
	Set zTimeConvert = New clsTimeConvert

	'If no value is available ...
	If zArvValues Is Nothing Then
		'... then inform the user
		MsgBox ("No archive values available!")
	
	'Otherwise:
	Else
		'Create a new archive value
		'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
		'!! ATTENTION:												 !!
		'!!   This code is designed for spontaneous archive types.	 !!
		'!!   If it is used in combination with a cyclic archive, this   !!
		'!!   code may corrupt the archive, which results in an loss of  !!
		'!!   data.													!!
		'!!															!!
		'!!					USE AT YOUR OWN RISK					!!
		'!!															!!
		'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	
		'Initialize zArvValue by creating a new value entry
		Set zArvValue = zArvValues.CreateArchiveValue

		'Set the state of the value to a manual entry
		zArvValue.Status = &H1000
		'Set the time when the value was entered
		zArvValue.Time = zTimeConvert.System2zenOn(CDbl(CDate("30.07.2007 12:00:00")))
		'Set the milliseconds, in addition to the time
		zArvValue.TimeMilliSec = 0
		'Set the desired value
		zArvValue.Value = 1531

		'Apply the modifications to the value
		zArvValue.SetModified
	
		'For every archive value within the collection
		For i = 0 To zArvValues.Count - 1
			'Assign the current archive value to zArvValue
			Set zArvValue = zArvValues.Item(i)
			'Output the count of the value
			Debug.Print i + 1 & ". Value"
			'Output the date and time when the value was recorded
			Debug.Print vbTab & "Date / Time: " & Format(zTimeConvert.zenOn2System(CDbl(zArvValue.Time)), "yyyy-mm-dd hh:mm:ss") & "." & zArvValue.TimeMilliSec
			'Output the recorded value
			Debug.Print vbTab & "Recorded value: " & zArvValue.Value
			'Output the state of the value
			Debug.Print vbTab & "State: &H" & Hex(zArvValue.Status)
		Next i
	End If
End Sub