Examples: getNthDocument method (View - Java)

This agent gets the first document in the last main category of a categorized view.

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");
      Document doc = view.getNthDocument(view.getTopLevelEntryCount());
      System.out.println(doc.getItemValueString("Subject"));
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}