Examples: createColumn method

This agent creates a new column at the end of the "By Category" view based on the Subject2 field.

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");
      ViewColumn col = view.createColumn(
        view.getColumnCount() + 1,
        "Topic 2", "Subject2");
      System.out.println("Position: " + col.getPosition());
      System.out.println("Title: " + col.getTitle());
      System.out.println("Formula: " + col.getFormula());

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