Remarks Properties Methods Samples

not used


The "ArchiveFilter" object is used to filter archive entries by a specified date / time and state.


CountArchiveVariables EndTime Parent
Raster StartTime StatusBit


AddArchiveVariable ApplyChanges ArchiveFilterVariables
ArchiveFilterVariablesInfo ArchiveFilterVariablesInfoEx DynPropertiesEnum[GET]
DynProperties[GET] DynProperties[PUT] ItemArchiveVariable
Query QueryBlock QueryBlockEx


Sub zenOn_ArchiveFilter()
	Dim zArchive As Archive
	Dim zArvFilter As ArchiveFilter
	Dim zArvVars As ArchiveFilterVariables
	Dim zTimeConvert As clsTimeConvert
	Dim dTime As Double
	Dim i As Integer

	'Initialize zArchive with the first available archive
	Set zArchive = thisProject.Archives.Item(0)

	'If no archive is availabe, then ...
	If zArchive Is Nothing Then
		'... inform the user
		MsgBox ("No archive available!")
		'Initialize zArvFilter by creating a new archive filter
		Set zArvFilter = zArchive.ArchiveFilters.CreateArchiveFilter
		'Every archive variable within the collection...
		For i = 0 To zArchive.ArchiveVariables.Count - 1
			'... will be added to the archive filter
			zArvFilter.AddArchiveVariable zArchive.ArchiveVariables.Item(i)
		Next i
		'Initialize zTimeConvert by creating a new instance of the zenOn "clsTimeConvert" macro
		Set zTimeConvert = New clsTimeConvert
		'Set dTime by converting the desired system time into the zenOn compatible UTC time
		dTime = zTimeConvert.System2zenOn(CDbl(CDate("30.07.2007 14:00:00")))
		'Set the converted time as the start time for the filter
		zArvFilter.StartTime = dTime
		'Set dTime by converting the desired system time into the zenOn compatible UTC time
		dTime = zTimeConvert.System2zenOn(CDbl(CDate("31.07.2007 11:15:00")))
		'Set the converted time as the end time for the filter
		zArvFilter.EndTime = dTime
		'All I-BIT and HWERT bits
		zArvFilter.StatusMask = &H41000	 'Check only I-BIT + HWERT
		zArvFilter.StatusBit = &H41000	'Return data if one of those bits are TRUE or both
		'Initialize zArvVars by initiating a new filter query
		Set zArvVars = zArvFilter.Query
		'For every filtered variable within the result...
		For i = 0 To zArvVars.Count - 1
			With zArvVars.Item(i)
				'... output the name of the variable ...
				Debug.Print "Variable: " & .ArchiveVariable.Name
				'... and the amount of I-BIT and HWERT bits within the specified time range
				Debug.Print vbTab & "I-BIT + HWERT: " & .ArchiveValues.Count & vbNewLine
			End With
		Next i
	End If
End Sub