Search DominoPower's 11,441 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Great scripts for discussion forums (continued)

<FORM METHOD=post ACTION="//idea.nsf/SiteSearch?CreateDocument"; ENCTYPE="multipart/form-data">

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:

Print "[//idea.nsf/SiteSearch?OpenForm&;redo]"

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:

Print "[//idea.nsf/Chat/"; & sortArray(i).Universalid & "?OpenDocument]"

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


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Internet Technologies > JavaScript (13 articles)
   Sorting your Domino views with JavaScript
   Give your Domino views life with DHTML
   Using dynamically generated HTML to thwart spam email address harvesting
Home > Social Computing (25 articles)
   Integrating Twitter with an IBM internal social network
   Fun with Sametime and Skype
   More thoughts on social computing and Lotus
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- 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.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login