Examples: getPrevDocument method

This agent gets all the documents in the By Category view of the current database in reverse order.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      View view = db.getView("By Category");
      System.out.println
      ("***By Category view - all documents in reverse***");
      Document tmpdoc;
      Document doc = view.getLastDocument();
      while (doc != null) {
        System.out.println
        ("\t" + doc.getItemValueString("Subject"));
        tmpdoc = view.getPrevDocument(doc);
        doc.recycle();
        doc = tmpdoc;
      }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}