Historical Values (D2000 VBApi)
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
arr | Array of the result values got from the archive after the successful calling. |
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 the Historical value type. |
col | Column of structured object of the Historical value type. |
writeMethod | Returns the archiving method of for writing into archive.
|
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: