Processing Data

The main subroutine,Form_Load(), obtains the login information, starts logging if required, then creates the LINCEnvironment object and sets its attributes. The following code creates and sets the LINCEnvironment object:

Set Linc = CreatObject("LINCEnvironment.Java.1")
Linc.setName ("Test LINC VB")
Linc.setPackagePrefix ("testclasses.nt")
Linc.setApplicationName ("sample_nt")
Linc.setBundleName ("all")

After handling connection to the Remote Access server and establishing a Component Enabler session and login, Form_Load() sends a HI command to the system if a fireup Ispec is required. There is a separate function defined to send the command and handle the return of the fireup Ispec. Refer to SayHi function for an example of this processing, which creates an IspecModelRef object for the Ispec and gets the IspecModel object and status information.

In this example, there is only one Ispec used, so Form_Load() creates a Cust IspecModel object and requests the Cust Ispec from the system as follows:

Set Cust = Linc.getIspec(Cust)

Dim res As Boolean
res = Linc.loadIspec(Cust)

It uses Ispec.getFieldValue in the CopyFromIspec() subroutine to insert field values from the Ispec to the form:

Public Sub CopyFromIspec()
CustNo.Text = Cust.getFieldValue ("CUSTOMER")
CustName.Text = Cust.getFieldValue ("SAMNAME")
CustAddr1.Text = Cust.getFieldValue ("POSTADD1")
CustAddr2.Text = Cust.getFieldValue ("POSTADD2")
CustAddr3.Text = Cust.getFieldValue ("POSTADD3")
CustLimit.Text = Cust.getFieldValue ("CREDLIMIT")
CustType.Text = Cust.getFieldValue ("CUST_TYPE")
CustRep.Text = Cust.getFieldValue ("SALESREP")
Status.Caption = xstatus.getstatus()
End Sub

In a similar way, any values entered by the user are copied to the system using Ispec.getFieldValue in the CopyFromForm() subroutine.

Public Sub CopyFromForm()
Cust.setFieldValue "CUSTOMER", CustNo.Text
Cust.setFieldValue "SAMNAME", CustName.Text
Cust.setFieldValue "POSTADD1", CustAddr1.Text
Cust.setFieldValue "POSTADD2", CustAddr2.Text
Cust.setFieldValue "POSTADD3", CustAddr3.Text
Cust.setFieldValue "CREDLIMIT", CustLimit.Text
Cust.setFieldValue "CUST_TYPE", CustType.Text
Cust.setFieldValue "SALESREP", CustRep.Text
End Sub

When the user enters data and clicks one of the buttons, it sets the Maint field with the value of the string returned by the button selected, sets the ACTION field to a null, and performs the requested transaction:

Cust.setFieldValue "Maint", maint
Cust.setFieldValue "Action", ""

The sample provided contains only one form, so the simpleTransaction method is used. If more than one Ispec might be returned, the transaction method might be more appropriate.