Evaluate function too many documents

Hi,For this script, when i have under 800 documents in the list it works.

But, over 800 documents I have an “Operation failed” error. The error occured at the Evaluate function line.

Someone has an idea to resolve the problem ?

Thank you very much.

Bob.


'Merge fields into list that can be used for sorting using @Sort function

For i = 0 To coll.Count - 1

If Not strSort = “” Then strSort = strSort & “:”

strSort = strSort & “”“”

For n = LBound(fieldnames) To UBound(fieldnames) + 1

strSort = strSort & Left(arrSort(i,n) & Space(arrFieldValueLength(n)), arrFieldValueLength(n))

Next n

strSort = strSort & “”“”

Next i

’ —

’ — 2) Sort array

’ —

arrSort = Evaluate(“@Sort(” & strSort & “: " & directionSort &”)")

’ —

’ — 3) Use sorted array to sort collection

’ —

Set collSorted = coll.Parent.GetView(viewname).GetAllDocumentsByKey(fakesearchstring)

For i = 0 To Ubound (arrSort)

Set doc = db.GetDocumentByUNID(Right(arrSort(i), 32))

Call collSorted.AddDocument(doc)

Next i

’ —

’ — 4) Return collection

’ —

Set SortCollection = collSorted

Exit Function

Subject: Interesting. Do people sort whole docs this way much?

If there’s a string you can generate that you want to sort by … I’m kind of wondering why you’d want to try to sort it within code.

1- The way I’ve seen this done in Notes is to simply put the sort value in a field on the document. Then you can sort a view by it, directly. At that point a NotesViewEntryCollection can return any part of the list in sorted order, and the view can return the docs in sorted order as well.

2- If you don’t want the field in the doc, but the data on sorting the doc all depends on the values in the doc, you can set up a column that’ll perform the calculation & produce the sort.

3- Want to change the sorting function? You coan make the sorted column a profiled column. Then you just change the profiled formula.

Subject: You’re probably hitting the 32k limit in the formula language.

Why don’t you use a Lotusscript sort function? There are loads of examples on the web.