Customized Search command

Hi,

In Lotus Notes, there is a predefined Search command(“Start with…Search text”) which allows user to search a specific document from a VIEW. To have an equivalent function, is there any command, formula or script which provides this search?

The scenario behind is that we have a bar code label which consists of a part number and a serial no. within the same line in which from the Lotus Notes VIEW, I just want to search by the part no. only, which means I have to get rid of the serial no. and focus on the search of the part no only. For example, the part no. is AAABB and the serial no. is 0001, so in the label, it will be AAABB 0001 and I would like to make a search

command by eliminating the and 0001.

Thanks ahead appreciate your help!

Kenny

Subject: Customized Search command

Hi, You can use below piece of code… which is an agent…Just on “Search” button, you call this agent… this will work fine. You need to do minor modifications… Thank You!

Sub Initialize

Dim wSession As New NotesSession

Dim dbCurrent As NotesDatabase

Dim docContext As NotesDocument

Dim docResult As NotesDocument

Dim dcolSearch As NotesDocumentCollection

Dim view As NotesView

Dim searchFrom As New NotesDateTime("01/01/2000")

Dim delim As String

Dim FinalFormula As String

Dim docresview As NotesViewEntry

Dim testdoc As NotesDocument

Dim TestViewCollection As NotesViewEntryCollection

On Error Goto ErrorHandler



Set dbCurrent = wSession.CurrentDatabase

Set docContext=wSession.DocumentContext

Set view=dbCurrent.GetView("cnfSupInfo1")



key= docContext.Search(0)

Set dcolSearch=view.GetAllDocumentsByKey(key)



BaseURL="http://"+ docContext.Server_Name(0)+"/"+docContext.webName(0)+"/"+docContext.dbURL(0)

htmlHeader={

        <BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#800080" TEXT="#000000">

              <link rel='stylesheet' type='text/css' href='/scar/scar.nsf/styleSheet.css?OpenPage'>

              <TABLE WIDTH="100%" BORDER=0 CELLSPACING=0>

                 <TR VALIGN=bottom>

                   <TD class="tableLabels"><B>Search Results</B></TD>

                   <TD WIDTH="50%" class="tableLabels"><DIV ALIGN=right>

                     <P><B><FONT COLOR="808080">SCAR Database</FONT></B></P>

				</DIV></TD></TR>

			</TABLE>

          }

Print htmlHeader

Print Cstr(dcolSearch.Count) + " documents found.<br></br>"



viewhead = {

<table cellpadding=0 cellspacing=0 width=100% width="100%" border="0" cellspacing="0" cellpadding="0">

 <tr valign="top"><td width="100%">

<table border="1" cellpadding="2" cellspacing="0">
		<td align="center"><H1>Supplier Name</H1></td>

		<td align="center"><H1>Supplier Location</H1></td>

		<td align="center"><H1>Quality Manager</H1></td>

		<td align="center"><H1> QM Email Id</H1></td></tr>}



Set docResult =dcolSearch.GetFirstDocument()

Print viewhead			



Do While Not docResult  Is Nothing

	Print "<tr><td><a href= "+BaseURL+"/"+docResult.NoteID+"/"+docResult.UniversalID+"?OpenDocument"+">"+docResult.fldSupplierName(0)+"</a>"+"</td><td>"+docResult.fldSupplierLocation(0)+"</td><td>"+docResult.fldQualityManager(0)+"</td><td>"+docResult.fldQMEmailId(0)+"</td></tr>"

	Set docResult=dcolSearch.GetNextDocument(docResult)

Loop

Exit Sub

ErrorHandler:

Print Error + " at " Cstr(Erl)

'End Sub

End Sub