Examples: ColumnValues property (Document - Java)

This agent gets the column values of all documents in a database, taking care to determine the data type of each value.

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("Status");
          Vector v, v2;
          String s, tabs;
          DateTime dt;
          Double d;
          Document doc = view.getFirstDocument();
          while (doc != null) {
            v = doc.getColumnValues();
            tabs = "";
            for (int i=0; i<v.size(); i++) {
              if 
             (v.elementAt(i).getClass().getName().endsWith("String"))
                s = (String)v.elementAt(i);
              else if
             (v.elementAt(i).getClass().getName().endsWith("DateTime")) {
                dt = (DateTime)v.elementAt(i);
                s = dt.getLocalTime(); }
              else if
             (v.elementAt(i).getClass().getName().endsWith("Double")) {
                d = (Double)v.elementAt(i);
                s = d.toString(); }
              else if
              (v.elementAt(i).getClass().getName().endsWith("Vector")) {
            	   v2 = (Vector)v.elementAt(i);
            	   s = "";
            	   for (int j=0; j<v2.size(); j++) {
            	     s = s + "*" + v2.elementAt(j).toString() + "*"; } }
              else
                s = "not String, DateTime, Double, or Vector: " + 
                	v.elementAt(i).getClass().getName();
              if (s.length() == 0) s = "*no value*";
              System.out.println(tabs + s);
              tabs = tabs + "\t"; }
            doc = view.getNextDocument(doc); }
 
 
      } catch(Exception e) {
          e.printStackTrace();
       }
   }
}