Examples: Formula property (ViewColumn - Java)

This agent toggles the value of a view column formula.

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 vc = view.getColumn(3);
      if (vc.isFormula()) {
        if (vc.getFormula().equals("@Created"))
          vc.setFormula("@Modified");
        else
          vc.setFormula("@Created");
      }
      System.out.println("Formula = " + vc.getFormula());
        
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}