Add a program doc to compact Lotus Notes databases automatically

This tip helps you add a program doc to your Lotus Notes users' local address books to reduce the size of their Notes databases automatically.
Related resources from SearchDomino.com:
Lotus Notes Domino Database Management Reference Center

Formula Language for Lotus Notes Domino Reference Center

This is a useful workaround for external salespeople with large local replicas, for example. These users need to simply leave their computers on at night for the doc to compact all of their Lotus Notes databases. This is easier than sending out batch files that require users to sign in and close their Lotus Notes clients.

To get started, follow these steps.

  1. Create a copy of the pernames.ntf
  2. Copy the Server\Programs view from your Public Address Book (PAB) template and paste it into the pernames.nsf. Rename this: Programs.
  3. Copy the Server\Program form from the Public Address Book (PAB) template and paste it into the pernames.nsf. Rename this: Program.
  4. Create an agent called Program Doc.
  5. Set the form selection to equal the Program form; the field CmdLine should not contain -A.
  6. Note: The latter is important because if you use local archiving, a program doc is created automatically when you set up local archiving. You can check this initially by opening the hidden view $Programs. If you use local archiving, or have in the past, you will one there showing Compact -A.

  7. Add this Formula language code to your agent:
  8. tempName := @Name
    @SetField( "Source" ; tempName ); 
    @SetField( "CmdLine" ; "-B" ); 
    @SetField( "Enabled" ; "1" ); 
    @SetField( "Interval" ; "0" ); 
    @SetField( "Program" ; "Compact" ); 
    @SetField( "Schedule" ; "02:00 AM" ); 
    @SetField( "WeekDays" ; "Sun, Mon, 
    Tue, Wed, Thu, Fri, Sat" ); 
    SELECT @All 
  9. Set the runtime to Agent List Selection, and set it to run on All Documents in Database.
  10. In the Programs view, add an action called Create Program Doc with a button using the following Formula language code:
  11. Cmd := @DbColumn
    @If(Cmd="-B"; @Return(""); ""); 
    REM {Above code is to prevent the 
    user from creating more than one 
    Compact -B documents and is a 
    back up to the sometimes flaky Hide
     Action When Formula Is True code}; 
    @Command( [RunAgent] ; 
    "(Program Doc)" ); 
    ( [RefreshHideFormulas] ); 
    @MailSend( "yourname@domain.com" ; 
    "" ; "" ; "Compact -B Doc Created" ; "" ; ""); 
    REM {Above is let you know that the 
    user has created the program document}; 
    "To compact your databases, leave Lotus 
    Notes open during the night.  Databases 
    will be compact at 2:00 am your time. 
    This process will recover space on your PC 
    and will increase performance. If you have 
    any questions, contact the Help Desk"); 
  12. In the "Hide Action When Formula is True", put this code in:
  13. Cmd := @DbColumn("":"ReCache";"":
  14. Finally, replace the design of your PAB with the new template. Instead of seeing pernames.nsf, you should see the new copy of pernames.nsf. Go to the "Programs" view and click on the button. Your program doc is now set to run Compact -B daily at 2 a.m. on your local machine.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Justin Eiseman. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

This was first published in June 2008

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.