Description
Application Object
Before you can use the Engineering Link, you have to create an Application Object. The Application object is the central portal for Engineering Link functionality. First of all, add a reference to the Engineering Link API in the Visual Basic project. Select "Isah Engineering Library" on the COM tab of the References in the project settings. You can now use functionality of the Engineering Link API.
Use the code below to create the Application object. By placing the object in a global variable you can use the object in other functions.
Dim oPDMLink As IPDMLink.Application
Set oPDMLink = new IPDMLink.Application
Integration Server
By creating an Application object an Integration Server object will be created and also there will be a check for licenses for both the applications. The Engineering Link only functions when the Integration server is present. The Integration Server object is available via the Engineering Link API. In order to use the Integration Server methods and properties you have to assign the object to a IERPLink.Application variable.
Dim oERPLink as IERPLink.Application
oERPLink = oPDMLink.ERPLink
Database Connection
Almost all Engineering Link functionality makes use of the Isah database and therefore an active database connection is required. The user must be logged in (in Isah and the database) to determine his rights. Apart from the Connect and Disconnect methods the Engineering Link has no login functionality, so the Connection object of the Integration Server should be used for logging in. The login can be performed with or without a login form: either the login data can be entered in advance or entered by the user. You can find an example of both situations below. When the login data are correct and valid the database connection will be created.
Logging in Without a Login Form
oPDMLink = New IPDMLink.Application
oERPLink = oPDMLink.ERPLink
oERPLink.Connection.DatabaseAliasname = "DemoDB"
oERPLink.Connection.Username = "Guest"
oERPLink.Connection.Password = ""
oERPLink.Connection.ShowLoginDialog = False
oERPLink.Connection.Connect()
Logging in With a Login Form
oPDMLink = New IPDMLink.Application
oERPLink = oPDMLink.ERPLink
oERPLink.Connection.Connect()
The default value for ShowLoginDialog is TRUE, so in the example above the login form will be showed in which the user can enter Administration, Name and Password. When the user clicks the OK button, the database connection will be created. You can check this by retrieving the Connected property.
If oERPLink.Connected then
MsgBox "Connected with the database."
Else
MsgBox "No connection with the database."
End If