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



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury