Add a program doc to compact Lotus Notes databases automatically

Learn the steps to add a program doc to Lotus Notes users' local public address books to compact large Lotus Notes databases automatically without closing the client.

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
    ([ABBREVIATE];@GetProfileField
    ("directoryprofile";"Owner")); 
    @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
    ("":"ReCache";"":"";"Programs";3); 
    @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([Compose]; 
    "Program"); 
    @Command([FileSave]); 
    @Command([CloseWindow]); 
    
    @Command( [RunAgent] ; 
    "(Program Doc)" ); 
    
    @Command
    ([ToolsRefreshAllDocs]); 
    @Command
    ( [RefreshHideFormulas] ); 
    
    @MailSend( "yourname@domain.com" ; 
    "" ; "" ; "Compact -B Doc Created" ; "" ; ""); 
    REM {Above is let you know that the 
    user has created the program document}; 
    
    @Prompt([Ok];"Complete";
    "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"); 
    
    @Command([CloseWindow]) 
    
  12. In the "Hide Action When Formula is True", put this code in:
  13. Cmd := @DbColumn("":"ReCache";"":
    "";"Programs";3); 
    Cmd="-B"
    
  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

Dig deeper on Lotus Notes Domino Database Management

0 comments

Oldest 

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:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close