Examples: createView method

This agent creates a new view and adds two columns by copying them from another 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 viewAll = db.getView("All Documents");
      View viewTopics = db.createView("Topics", "SELECT @All");
      ViewColumn col1 = viewTopics.copyColumn(viewAll.getColumn(5), 1);
      System.out.println("Column " + 
        col1.getPosition() + " = " + col1.getTitle());
      ViewColumn col2 = viewTopics.copyColumn(viewAll.getColumn(1), 2);
      System.out.println("Column " + 
        col2.getPosition() + " = " + col2.getTitle());

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}