1

Тема: Поиск

Производит поиск документов по заданным критериям и найденные документы отображает в папке.

(Declaration)
Dim session As NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim profile As NotesDocument
Dim collection As NotesDocumentCollection
Dim view As NotesView
Dim entry_collection As NotesViewEntryCollection

(Initialize)
Set session = New NotesSession

Set db = session.CurrentDatabase

Set doc = session.DocumentContext

Set view = db.GetView("($profile)")
Set profile = view.GetFirstDocument

Call Search(doc)

Sub Search(doc As NotesDocument)
Dim search_str As String
Dim searchConsultantType As Variant
Dim list_members As String
Dim coord_place As NotesDocument

Select Case doc.category(0)
Case "0"
search_str = "Form = ""consultrequest"""
If doc.request_contact_person(0) <> "" Then search_str = search_str + " & " + "contact_person = """ + Trim$(doc.request_contact_person(0)) + """"


Set collection = db.Search(search_str, Nothing, 0)
Set view = db.GetView("SearchResults")
Set entry_collection = view.AllEntries
Call entry_collection.RemoveAllFromFolder("SearchResults")
If collection.Count <> 0 Then
Call collection.PutAllInFolder("SearchResults")
Call view.Refresh
End If

Set coord_place = New NotesDocument(dB)
coord_place.Form = "coordinator_place"
coord_place.menu = "SearchResults"
coord_place.title = ":: Результаты поиска  докуметов
coord_place.is_folder = 1
Call coord_place.ComputeWithForm(False, False)
Call coord_place.Save(True, True)
Print "[" + profile.db_directory(0) + "/" + db.FileName + "/0/" + coord_place.UniversalID + "?OpenDocument]"

End Sub



> у юзверя права должны быть на папку и на запись общих доков
и зачем коллекция?
есть стандартное стредство поле Return в форме поиска
DBName:=@Subset(@DbName;-1);
"[[/"+DBName+"/вид для отображения результатов/?SearchView&Query="+Query+"&SearchOrder="+@Text(Sort)+"&SearchMax="+@Text(MaxResults)+"&SearchWV="+@If(ExactMatch="";"TRUE";"FALSE")+"&SearchThesaurus="+@If(UseThesaurus="";"FALSE";"TRUE")+"]]"

Поделиться