Question

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.

Was it helpful?

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.

OTHER TIPS

Richard's response is perfect! For a java version it's almost the same: see the Domino help for getNextCategory the given example below ViewNavigator really answer your need: link here
The evaluate method is also available in java Session

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top