Domino Code Fragment
Code Name* Evaluate method | Date* 04/28/2024 | Source (or email address if you prefer)* Rlatulippe@romac.com IP address:.3.128.199.88 | |
Description* 2. This agent applies the @Sum @function to the Amount field (which allows multiple values) in each document and prints the result. | Type* Java | Categories* (Misc) |
Implementation: | Required Client: | Server: |
Limitations: | Comments: |
public class evaluate3agent extends AgentBase
{
public void NotesMain()
{
try
{
Session s = getSession();
AgentContext ac = s.getAgentContext();
Database db = ac.getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
Document doc;
System.out.println("Count = " + dc.getCount());
for (int j=0; j<dc.getCount(); j++) {
doc = dc.getNthDocument(j);
Vector v = s.evaluate("@Sum(Amount)", doc);
System.out.println(v.firstElement() + " " +
doc.getItemValue("Subject"));
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}