< Back

Document Subject: How do you test if a database is empty?
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#DatabaseEmpty or http://A555F9/nn.nsf/ByAlias/DatabaseEmpty

How do you test if a database is empty?




 

You can check to see if a database has documents by using lotusscript with:

dim s as new notessession
dim db as notesdatabase
set db = s.currentdatabase
dim col as notesdocumentcollection
set col = db.alldocuments
msgbox "docs: " & col.count

so if col.count is nothing there are no documents, or you have access to no documents.

Also in lotusscript you can test to see if there are any forms or views or agents in the database using
msgbox "views:" & UBOUND(db.views)+1
msgbox "forms:" & UBOUND(db.forms)+1

also in @function you could use:
r:=@dbcolumn("":"NoCache";"";"viewname");
@if(@iserror(r);
 @prompt([ok];"error";@text(r));
 @prompt([ok];"docs:"+@text(@elements(r))
)

If I think of anymore I will let you know.