Subject: More details?
Well, you can’t perform a greater than/less than comparison on strings, that is why you should always think through the field types before you start designing. However, 50,000+ documents is not hard to modify, you can use either NoteMan or Ytria scanEZ to do that in a few minutes. At least one (preferably both) should be in your toolbox anyway…
But if you don’t want to do that, describe the agent where you are doing the db.FTSearch call. Is it being run by users or schedule on server? How often is it run? How many documents are expected to be returned?
There are several other ways to perform a similar search/lookup. FTsearch is (normally) limited to returning 5000 documents, so writing the code in a different way could return more if that is needed.
Here is one approach:
Create a hidden view, with two columns.
SELECT Form=“yourformname”
The first column contains the formula @TextToNumber(RegionNumber) and is sorted descending.
The second column contains @Text(@DocumentUniqueID)
Your code would then look something like this (only relevant code included, not tested):
Dim view As NotesView
Dim col As NotesViewEntryCollection
Dim entry As NotesViewEntryset
Dim mydoc List As Integer
view = db.GetView(“(HiddenLookupView)”)
set col = view.AllEntries
set entry = col.GetFirstEntry
Do While Not entry Is Nothing
If IsNumeric(entry.ColumnValues(0)) Then
If Cint(entry.ColumnValues(0))>=30 Then
mydoc(entry.ColumnValues(1)) = Cint(entry.ColumnValues(0))
End If
End if
set entry = col.GetNextEntry(entry)
Loop
You now have a list of documents where the region number is 30 or greater. The listtag is the UNID of the document (which makes for easy access to it if you need) and the list item value is the region code.
That is how I would have done it.