Examples: IsCategory property

This agent displays the number of categorized columns in a view.

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 vcs = view.getColumns();
      int counter = 0;
      for (int i=0; i<vcs.size(); i++) {
        ViewColumn vc = (ViewColumn)vcs.elementAt(i);
        if (vc.isCategory()) counter++;
      }
      if (counter == 0)
        System.out.println("View contains no categorized views");
      else if (counter == 1)
        System.out.println("View contains 1 categorized view");
      else
        System.out.println("View contains " + counter +
          " categorized views");
        
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}