286 IBM Workplace Forms: Guide to Building and Integrating a Sample Workplace Forms Application
If Instr(cust_id, "[") > 0 And Instr(cust_id, "]") = Len(cust_id) Then
'extract ID from input patameter
cust_id = Strleft(Strrightback(cust_id,"["), "]")
End If
Set view = db.getView("Customers")
'get the document
Set entry = view.GetDocumentByKey(cust_id, True)
If Not entry Is Nothing Then
'read the fields
cInfo.cust_id= entry.getItemValue("cust_id")(0)
cInfo.cust_name= entry.getItemValue("cust_name")(0)
cInfo.cust_amgr= entry.getItemValue("cust_amgr")(0)
cInfo.cust_contact_name= entry.getItemValue("cust_contact_name")(0)
cInfo.cust_contact_position= entry.getItemValue("cust_contact_position")(0)
cInfo.cust_contact_phone= entry.getItemValue("cust_contact_phone")(0)
cInfo.cust_contact_email= entry.getItemValue("cust_contact_email")(0)
cInfo.cust_crm_no= entry.getItemValue("cust_crm_no")(0)
Else
Messagebox "entry not found: " & cust_id
End If
Set getCustInfo = cInfo
Exit Function
errorhandler:
Messagebox "Error " & Err() & " in " & Lsi_info(2) & " line " & Erl() & ": " &
Error$
Resume Next
End Function
End Class
Save the service — it is ready to run.
The same procedure should be processed for the other Web services (EmployeeInfo and
ProductInfo).
9.5.2 Template Database: components to create a new form from template
The Template Database has the role of the application database. It will contain several
correlated design elements, which work together when creating new forms or opening
existing forms in the browser.
For form creation, we will have to create the following components:
A form to store templates
A form to render the HTML page shown to the browser when creating a new request
An initiation agent that will fill the rendering form
A View listing all available forms along with suitable links to compose a new XFDL form
from the template
At least one stored template with prepopulation settings applied to test the created design
elements.
Tip: The EmployeeInfo Web service is created but not used in the redpaper demo XFDL
form. You might not want to create it.