Hello forum!
I have built a wabsearch-agent whitch searches documents in a database and prints them out. But my problem is to sort them, because the users must have some sortoptions.
To do this i have built a workaraound for sorting the collection. But this workaraound is very slowly, so the response-time for users (with browsers) is very high.
Does anyone have a faster workaraound to sort a document collection? Or can anyone tell me, why this sorting is so slowly? This is the code (works ONLY with sorted collections!)
Dim doc As NotesDocument
Dim docSelected As NotesDocument
Dim i,j,k As Long
Set doc = coll.GetFirstDocument
j = coll.Count
For k=1 To coll.Count
For i=1 To j
If i=1 Then
Set docSelected = doc
Elseif Clng(doc.fldPrice(0)) < Clng(docSelected.fldPrice(0)) Then
Set docSelected = doc
End If
Set doc = coll.GetNextDocument(doc)
Next i
Call coll.DeleteDocument(docSelected)
Call coll.addDocument(docSelected)
Set doc = coll.GetFirstDocument
j = j - 1
Next k
Another optionis, to take the ftsearch method from a sorted view, but then i must delete the ft-index to have a sorted result…
Thank you for any answers!
Bernd