Count Number Of Docs In A View

many, many requests were made to discussion groups all over the Notes world on
how to count documents in a view.

90% of the answers was:

"read the view doc by doc and increase a counter"

This might work, if you have only few docs in a view.
But what if there are thousands ?

in Notes formula language it is possible to read a whole column of a view into
an array at once.

But i needed a solution in LS.

Well here is my solution.

The function is a combination of @formula and LotusScript using the

U can use this as generic function for @DBColumn in Lotus Script.
The function below returns only the first character of an entry in the row.
This is to not have an overflow when processing a large view.
(I guess that there is a limit of 64k for an array !?!?)

The function counts a view with 25.000 docs in about 2 seconds.
Function DBColumn(strClass As String, strNoCache As String, strServer As
String, strDatabase As String, strView As String, numCol As Integer) As Variant
quotes = Chr(34)
strFormula = "@Left(@Trim( @DbColumn(" & quotes & strClass & quotes & ":"
& quotes & strNoCache & quotes & ";" & quotes & strServer & quotes & ":" &
quotes & strDatabase & quotes & ";" & quotes & strView & quotes & ";" & numCol
& "));1)"
DbColumn = Evaluate( strFormula )
End Function


Sub Click(Source As Button)
Dim dummy As Variant
dummy = DbColumn ( "" , "NoCache" , "DEMEG01/ME/SRV/SHGDEV" ,
"DevIdea.nsf" , "Alpha" , 2 )
NumOfDocsInView% = Ubound ( dummy ) + 1
Msgbox NumOfDocsInView%
End Sub

Dig Deeper on Domino Resources - Part 3



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...