D2000 VBApi - Work with historical values

The calling the procedure VBApiGetArchData enables to get the historical values of some object of Historical value type. Values, got from the archive, are represented by a value array. Historical value is represented by the same structuree 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
arr Array 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!
name Name of object of Historical value type.
bt Begin time.
et End time.
step Time 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.
row Row of structured object of Historical value type.
col Column of structured object of Historical value type.
writeMethod Returns the archiving method of for writing into archive.
Return values:
  • 1 - periodically
  • 2 - on value change (Filter)
ok Return value - call success.

Return value
Value of the parameter ok.

Return value Description
0 Call successful.
1 Incorrect object name (also in case, that the object is not opened)
2 No logged on user.
3 Unexpected internal error.
4 Incorrect 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
name Name of object of Historical value type.
newValue New value with the time, for which is to be archived.
row Row of structured object of Historical value type.
col Column of structured object of Historical value type.
ok Return value - call success.

Return value
Value of the parameter ok.

Return value Description
0 Calling successful.
1 Incorrect object name (also in case, that the object is not opened)
2 No logged on user.
3 Unexpected internal error.
4 Incorrect 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:

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .