Examples: getNthEntry method

This agent gets the view collection entry at the position specified in the agent comment.

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");
      view.setAutoUpdate(false);
      ViewEntryCollection vec = view.getAllEntries();
      String comment = agentContext.getCurrentAgent().getComment();
      if (comment.equals("")) comment = "1";
      Integer N = new Integer(comment);
      ViewEntry entry = vec.getNthEntry(N.intValue());
      if (entry != null) {
        System.out.println(entry.getColumnValues().elementAt(0)); }
    } catch(NotesException e) {
      System.out.println(e.id + " " + e.text);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}