Examples: ColumnCount and ColumnNames properties

This agent prints the number of columns in a view and the names of the columns.

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");
      int count = view.getColumnCount();
      System.out.println
      ("\"By Category\" has " + count + " columns:");
      Vector columnNames = view.getColumnNames();
      for (int i=0; i<columnNames.size(); i++) {
        System.out.println("\t#" + new Integer(i+1) + "\t" +
        (String)columnNames.elementAt(i)); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}