-
1
- #1
I found out how to look for specified documents and how to count documents having specified values in specified fields, in a fast way: use db.SEARCH function .
Example:
How many documents use "MainForm" form and have "7" value in "DocIcon" field?
That's easy:
Resulting searchstring$ value:
Form = "MainForm" & DocIcon = 7
(' & """" ' allows adding quotes inside a string. )
You can also limit search to documents modified after a specified date, by replacing "Nothing" with a StartDate variable defined like this:
-- Jumpjack --
Example:
How many documents use "MainForm" form and have "7" value in "DocIcon" field?
That's easy:
Code:
Dim session As Object
Dim db As Object
Dim GlobalCOllection As Object
Set session = CreateObject("Lotus.Notessession") ' Connect to Lotus 7. Use "Notes.Notessession" for previous releases.
Call session.Initialize(riga) ' Only Lotus 7 allows login from external application
Set db = session.GETDATABASE(SERVER, DBNAME) ' Open DB
field1 = "Form"
value1 = "MainForm"
field2 = "DocIcon"
value2 = "7"
SearchString$ = field1 & " = " & """" & value1 & """" & " & " & field2 & " = " & value2
Set GlobalCollection = db.SEARCH(SearchString$, Nothing, 0)
c=GlobalCollection.count
Resulting searchstring$ value:
Form = "MainForm" & DocIcon = 7
(' & """" ' allows adding quotes inside a string. )
You can also limit search to documents modified after a specified date, by replacing "Nothing" with a StartDate variable defined like this:
Code:
Dim session As Object
Dim db As Object
Dim GlobalCOllection As Object
Dim datetime As Object
Dim DateString as string
DateString = "25/02/2006"
Set datetime = session.CREATEDATETIME(DateString) ' Convert date to Notes format
Set session = CreateObject("Lotus.Notessession") ' Connect to Lotus 7. Use "Notes.Notessession" for previous releases.
Call session.Initialize(riga) ' Only Lotus 7 allows login from external application
Set db = session.GETDATABASE(SERVER, DBNAME) ' Open DB
field1 = "Form"
value1 = "MainForm"
field2 = "DocIcon"
value2 = "7"
SearchString$ = field1 & " = " & """" & value1 & """" & " & " & field2 & " = " & value2
Set GlobalCollection = db.SEARCH(SearchString$, datetime, 0)
c=GlobalCollection.count
-- Jumpjack --