Examples: getEntryByKey method

  1. This agent gets the first entry in the first category that begins with "Spanish" in the By Category view of the current database.
    import lotus.domino.*;
    import java.util.Vector;
    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");
          ViewEntry entry =
          view.getEntryByKey("Spanish leather", false);
          if (entry != null) {
            Vector v = entry.getColumnValues();
            for (int i=0; i<v.size(); i++)
              System.out.println((i+1) + " " + 
                v.elementAt(i)); }
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. This agent gets the first entry in the category "Boots" in the subcategory "Spanish leather" in the By Category view of the current database.
    import lotus.domino.*;
    import java.util.Vector;
    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");
          Vector v = new Vector();
          v.addElement("Boots");
          v.addElement("Spanish leather");
          ViewEntry entry =
          view.getEntryByKey(v, false);
          if (entry != null) {
            Vector columns = entry.getColumnValues();
            for (int i=0; i<columns.size(); i++)
              System.out.println((i+1) + " " + 
                columns.elementAt(i)); }
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }