ArchiveFilter.QueryBlock



QueryBlock(vValues As Variant,vPvIDs As Variant) As Boolean

Parameters

vValues As Variant
"Variant" variable for the "QueryBlock" method, in order to store a cascaded array which is filled with the filtered variables and the recorded values.

The array is returned by the method, hence the user has only to pass an "Variant" variable.
vPvIDs As Variant
"Variant" variable for the "QueryBlock" method, in order to store an array of IDs of the corresponding filtered archive variables.

The array is returned by the method, hence the user has only to pass an "Variant" variable.
ED
not used
RT
avaliable

Remarks

Like the "Query" method, the "QueryBlock" command initiates the filtering of the data.

The difference between these two methods is, that the "QueryBlock" method is dedicated for performance oriented tasks, because the usage of arrays is faster than the approach of the "Query" method with the collections. The drawback of the "QueryBlock" method is the increased complexity of coding.

The "QueryBlock" command requires two parameters:

Sample

The following example initiates a filtering with the "QueryBlock" command and outputs the details of the filter result.

ATTENTION: The passed "ArchiveFilter" object has to be initialized beforehand, i.e. filter starttime and endtime, etc.

Hint:
In order to output the correct date and time of the filter result, the zenOn "clsTimeConvert" macro should be used.
For the macro code and further information on the macro and the time conversion, please have a look at the StartTime part.

Public Sub zenOn_ArchiveFilter_QueryBlock(ByRef zArvFilter As ArchiveFilter)
	'Declarations
	Dim zTimeConvert As clsTimeConvert
	Dim zPvIDs As Variant
	Dim zValues As Variant
	Dim i As Integer
	Dim j As Integer
	Dim vVarTemp As Variant
	Dim vValTemp As Variant
	Dim nVarCount As Integer
	Dim nValCount As Integer

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

	zArvFilter.QueryBlock zPvIDs, zValues

	'Get the number of variables and assign it to "nVarCount"
	nVarCount = UBound(zValues, 1)
	'For every filtered variable output the recorded values
	For i = 0 To nVarCount
		'Assign the current variable to "vVarTemp"
		vVarTemp = zValues(i)
		'Get the number of values within the variable and assign it to "nValCount"
		nValCount = UBound(vVarTemp, 1)
		'For every value within the filtered variable output the recorded details
		For j = 0 To nValCount
			'Assign the current value to "vValTemp"
			vValTemp = vVarTemp(j)
			'Output the count number of the current value
			Debug.Print j + 1 & ". Value"
			'Output the variable name to which the value belongs
			Debug.Print vbTab & "Var-Name: " & zArvFilter.ArchiveFilterVariables.ItemById(zPvIDs(i)).ArchiveVariable.Name
			'Output the ID of the variable
			Debug.Print vbTab & "Var-ID" & vbTab & ": " & CStr(zPvIDs(i))
			'Output the date and time when the value was recorded -> Format: year-month-day hour:minute:second.millisecond
			Debug.Print vbTab & "Time" & vbTab & ": " & Format(zTimeConvert.zenOn2System((vValTemp(0))), "yyyy-mm-dd hh:mm:ss") & "." & CStr(vValTemp(1))
			'Output the value that was recorded
			Debug.Print vbTab & "Value" & vbTab & ": " & CStr(vValTemp(2))
			'Output the state of the value
			Debug.Print vbTab & "State" & vbTab & ": &H" & Hex(vValTemp(3))
		Next j
	Next i

End Sub


See Also

ArchiveFilter