|
|
|
|
|
|
|
|
|
|
|
|
|
|
Great scripts for discussion forums (continued)
Both forms have QuerySaveAgents that include the script library. The general text search agent simply generates a Notes formula language query and builds a document collection with the database FTSearch method. The specific field value agent is more complicated. First the agent sets the initial value of the search string:
sfDefault$ = {Form = "IdeaLite" & docState= "Publish" & ideaAccess= "Public"}
|
Then, the agent needs to check if the user selected a value from each of the drop down lists. If so, the agent modifies the search sting:
searchMessage$ = "You searched for: "
ideaType$ = doc.ideaType(0)
If ideaType$ <> "-- ANY IDEA TYPE ----------------------" Then
searchFormula$ = searchFormula$ & {& @Contains(ideaType; "} & ideaType$ &{")}
searchMessage$ = searchMessage$ & "Idea Type: " & ideaType$ & " "
End If
|
At the same time the agent amends the string, it will display a message confirming the search criteria to the user. After checking, if there are any matches, the agent then builds a document collection using the database Search method:
Set dc = db.Search(searchFormula$, dt, 0)
|
Then the two agents use the exact same subroutines contained in the script library. These subroutines generate a URL if there were no matching documents, if there was only one matching document, or generate the HTML for an entire result set. If there were no matching documents, the agent generates a URL pointing to the search form, like this:
The "&redo" parameter tells the search form to display a usually hidden paragraph telling the user that no documents matched the search criteria. If the agent finds only one matching document, then it passes the universal ID of that document to the appropriate script library function, as this shows:
When more than one document is found the agent goes to another script library function. This function builds the entire needed HTML manually. After some basic HTML tags format the page, the agent loops through the returned document collection. Within this loop, the function checks the form and adds the appropriate field value as a label in the returned results. Also, the client required that rows be alternating colors to differentiate each returned document.
For i = 0 To querydc.Count - 1
If sortArray(i).Form(0) = "IdeaLite" Then
docLabel$ = sortArray(i).ideaName(0)
Elseif sortArray(i).Form(0)= "ResponseTopicIdea" Then
docLabel$ = "Chat: " & sortArray(i).Subject(0)
Elseif sortArray(i).Form(0)= "TIP" Then
docLabel$ = sortArray(i).pchTitle(0)
Elseif sortArray(i).Form(0)= "Quote" Then
docLabel$ = "Quote"
Else
docLabel$ = "NO TITLE"
End If
j = i + 1
num% = j Mod 2
If num% = 1 Then
color$ = | BGCOLOR="#e1e1e1"|
Else
color$ = ||
End If
Print {<TR><TD><FONT SIZE=3><a href="/idea.nsf/Chat/" & sortArray(i).Universalid & {?OpenDocument&FromView=Search">} & docLabel$ & "</FONT></a> </TR>"
Next i
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done.
Native to Lotus Domino. The User Experience unseen for Lotus Domino.
Do more with less. Really.
See the possibilities Docova unleashes for Lotus Domino. |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|