D2000 VBApi - VBApi module

The VBApi module contains the support for:

Reading data from archive



Declaration
Sub ReadArchData(ByRef objName As String, ByRef bt As Date, ByRef et As Date,ByRef step As Long, ByRef writeMethod As Long, ByRef a_data() As VBApi_TUniVal, ByRef ok As Long)

Parameters
objName 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.
writeMethod Returns the archiving method of for writing into archive.
Return values:
  • 1 - periodically
  • 2 - on value change (Filter)
a_data 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 !
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).
22 No logged on user.
3 Unexpected internal error.
4 Incorrect parameters.


User's logon


User's logon and establishing a communication route is provided by the procedure Connect. It is appropriate for interactive work with the report (workbook).

It checks the status of the VBApi interface and executes required initialization operations, including getting the user name and password using the logon dialog box, if logon has not been performed. The logon dialog box is implemented as the LogOnDlg form.


Declaration
Sub Connect(ByRef server As String, ByRef procDesc As String, ByRef wdFreq As Long)

Parameters
server Name of the computer with running D2000 Server (/S).
procDesc Description of the client process, that will be stored in the log database - process start record.
wdFreq Interval for sending watch dog messages used for verifying the communication route functionality. The parameter substitutes the parameter /F from the command line.

Note
User can change the parameters server and procDesc in the logon dialog box.


Logon without the user presence is allowed by the procedure D2KernelLogon.


Declaration
Public Property Get D2KernelLogon(name As String, pass As String, server As String, procDesc As String, ByRef wdFreq As Long)

Parameters
name User's name.
pass User's password.
server Name of the computer with running D2000 Server.
procDesc Description of the client process, that will be stored in the log database - process start record.
wdFreq Interval for sending watch dog messages used for verifying the communication route functionality. The parameter substitutes the parameter /F from the command line.



Call success can be checked by calling the function IsConnectOK.


Declaration
Function IsConnectOK() As Boolean


Related pages:

Napíšte komentár