D2000 VBApi - Work with historical values

The calling the procedure VBApiGetArchData enables to get the historical values of some objects of the Historical value type. Values, acquired from the archive, are represented by a value array. Historical value is represented by the same structure as the current value.


Declaration
Declare Sub VBApiGetArchData Lib "vbapi.dll" Alias "_GetArchData@28" (arr() As VBApi_TUniVal, ByRef name As String, ByRef bt As Date, ByRef et As Date, ByRef step As Long, ByRef writeMethod As Long, ByRef ok As Long)
 
or for structured objects of Historical value type
 
Declare Sub VBApiGetArchDataItem Lib "vbapi.dll" Alias "_GetArchDataItem@36" (Arr() As VBApi_TUniVal, ByRef name As String, ByRef row As Long, ByRef col As Long, ByRef bt As Date, ByRef et As Date, ByRef step As Long, ByRef writeMethod As Long, ByRef ok As Long)
Parameters
arrArray of the result values got from the archive after the successful calling.

Warning:
The array must not be dimensioned and must be empty before calling the procedure!
nameName of object of Historical value type.
btBegin time.
etEnd time.
stepTime step used for oversampling values in the archive (given in seconds). If it is 0, there will be read all values within the given time interval.
rowRow of structured object of the Historical value type.
colColumn of structured object of the Historical value type.
writeMethodReturns the archiving method of for writing into archive.
Return values:
  • 1 - periodically
  • 2 - on value change (Filter)
okReturn value - call success.
Return value
Value of the parameter ok.

Return valueDescription
0Call successful.
1Incorrect object name (also in case, that the object is not opened)
2No logged on user.
3Unexpected internal error.
4Incorrect parameters.


Modification of one value in the archive may be performed by calling the procedure VBApiChangeArchValue. New value is given by the parameter newValue. Time, for which the archive value is modified, is given by the value of ValTime in the structure VBApi_TUniVal.


Declaration
Declare Sub VBApiChangeArchValue Lib "vbapi.dll" Alias "_ChangeArchValue@16" (ByRef name As String, ByRef newValue As VBApi_TUniVal, ByRef ok As Long)
 
or for structured objects of Historical value type:
 
Declare Sub VBApiChangeArchValueItem Lib "vbapi.dll" Alias "_ChangeArchValueItem@20" (ByRef name As String, ByRef row As Long, ByRef col As Long, ByRef newValue As VBApi_TUniVal, ByRef ok As Long)
Parameters
nameName of object of Historical value type.
newValueNew value with the time, for which is to be archived.
rowRow of structured object of Historical value type.
colColumn of structured object of Historical value type.
okReturn value - call success.
Return value
Value of the parameter ok.

Return valueDescription
0Calling successful.
1Incorrect object name (also in case, that the object is not opened)
2No logged on user.
3Unexpected internal error.
4Incorrect parameters.
Note
If the archive contains no value for the given time (none to modify), then the value newValue will be inserted into the archive.

Related pages:

Napíšte komentár