|
|
|
|
|
|
|
|
Developing a Palm VII PQA that reads data from a Domino database (continued)
FIGURE B
The Customers PQA icon on the Palm VII.
Figure C shows the HTML form we designed in the code shown earlier in this article. Notice the Go submit button and the lines to the right of it. These lines indicate that tapping this button with the stylus will perform an "over the air" function and will require the user to raise the antenna on the Palm VII in order to complete the transaction.
FIGURE C
This is the Customers PQA asking for a customer name.
Figure D shows that I have requested the PQA to find all documents in the database that contain the word "Evergreen".
FIGURE D
Search for all Customer documents that contain the word "Evergreen".
Figure E shows the Web clipping generated by the LotusScript agent on the Domino server. Notice that there is a History button on the top right of Figure E. This button functions like the Address History in a Web browser. It stores past queries. Also notice the title "PalmBuilder" in the upper left corner. The LotusScript agent Web clipping generates both the History and the PalmBuilder elements.
FIGURE E
The Web clipping generated by the Domino server.
The Web clipping LotusScript agent So far I have shown you the PQA itself and how to create one for the Customer Tracking database. Now let's take a look at the Domino side of the equation and more specifically the agent used to generate the Web clipping.
Here's the code that actually generates the Web clipping content.
Sub Initialize
'Dimension some Objects
Dim s As New NotesSession
'doc is the document posted by the PQA
'cdoc is the actual customer document in the database
Dim doc, cdoc As NotesDocument
Dim db As NotesDatabase
Dim c As NotesDocumentCollection
Dim dateTime As New NotesDateTime("12/01/80")
'Get a handle to the document posted to the Domino server
Set doc = s.DocumentContext
'Read the REQUEST_CONTENT CGI variable and get the Customer name entered on
the PQA
Customer$ = Mid$(doc.REQUEST_CONTENT(0),Instr(1,doc.REQUEST_CONTENT(0),"=")
+ 1, Len(doc.REQUEST_CONTENT(0)))
'Tell the Domino server not to generate a HEAD tag
Print "Content-Type:text/plain"
Print "Content-Type:text/html"
'Generate our own HEAD tag and generate web clipping Meta tags required by
the PQA
Print "<head><Title>PalmBuilder</Title>"
Print "<meta name=palmcomputingplatform content=true>"
Print "<meta name=historylisttext content=" & Ucase$(Customer$) & ">"
Print "</head>"
'Get a handle to the current database
Set db = s.currentdatabase
'Search the database for the Customer name entered. Results are placed in a
document collection
Set c = db.ftsearch(Customer$, 0)
'How many did we find?
Print "Found " & c.count & " matches for customer " & Ucase$(Customer$) &
"<p><hr>"
'Did we find any documents?
If c.count >= 1 Then
'Loop through each document in the collection
For i = 1 To c.count
'Get a handle to the document
Set cdoc = c.getnthdocument(i)
'Generate the company name
Print "<B>" & cdoc.CompanyName(0) & "</B><p>"
Print cdoc.FirstName(0) & " " & cdoc.LastName(0) & "<p>"
'If there is a Phone number then let them know
If cdoc.Phone(0) <> "" Then
Print "Phone: " & cdoc.Phone(0) & "<p>"
End If
'If there is a FAX number then let them know
If cdoc.FAX(0) <> "" Then
Print "FAX: " & cdoc.FAX(0) & "<p>"
End If
'If there is a Customer Type assigned then let them know
If cdoc.CustomerType(0) <> "" Then
Print "Customer Type: " & cdoc.CustomerType(0) & "<p>"
End If
'If there is a Customer Status assigned then let them know
If cdoc.Status(0) <> "" Then
Print "Status: " & cdoc.Status(0) & "<p>"
End If
'If there is a Sales Person assigned then let them know
If cdoc.SalesPerson(0) <> "" Then
Print "Sales Person: " & cdoc.SalesPerson(0) & "<p><hr>"
End If
Next i
Else
'Oh no - no customer matches!
Print "<p>No Customers were found for your query<p>"
End If
'Give the user a way to go back and query another customer
Print "<a href=""file:CustStudio.pqa/custstudio.html"">Back</a><p>"
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|