Search code examples
categorieslotus-dominonotesview

Get all top level entry values from NotesView


What is the easiest way to get all top level entry values from a notes view? I have found the property "TopLevelEntryCount" returning the number of alle categories, but I want the values, too.

To iterate the view entries and column values need too much time.

Set ecl = view.Allentries
Set ve = ecl.Getfirstentry()
While Not(ve Is Nothing)
    If IsArray(ve.Columnvalues(0)) Then
        If flag = "" Then
            arr = ve.Columnvalues(0)
        Else
            arr = ArrayUnique(ArrayAppend(arr, ve.Columnvalues(0)))
        End If
    Else
        'error if arr is not already an array
        arr = ArrayUnique(ArrayAppend(arr, ve.Columnvalues(0)))
    End If

    flag = "1"
    Set ve = ecl.Getnextentry(ve)
Wend

Anyone know a faster way? It must not be written in LotusScript, actually I would prefer Java, JS or SSJS.


Solution

  • Idea 1: You can use the NotesViewNavigator class, and call the getFirst() and getNextCategory() methods. This should be faster than walking all the entries.

    Idea 2: You can use NotesSession.Evaluate() with a formula that does an @Unique on @DbColumn for the first column of view. That should bring you back an array, and you can get the ubound of the array. Formulas tend to be very fast, but evaluate() has to compile them first, so I don't know if this will be faster or not. The disadvantage of this approach is that for very large views, this could exceed formula language's size limits. But if it does prove to be faster, you could catch the exception and fall-back to the slower method of iterating.