Domino Code Fragment
Code Name* Making a Notes newsletter | Date* 04/28/2024 | Source (or email address if you prefer)* Rlatulippe@romac.com IP address:.3.145.60.166 | |
Description* 2. This agent creates a newsletter consisting of a picture of the document for each document in the current database that contains the word "arachnid." The documents are saved in Reports.nsf. | Type* Java | Categories* (Misc) |
Implementation: | Required Client: | Server: |
Limitations: | Comments: |
public class newsletter2agent extends AgentBase
{
public void NotesMain()
{
try
{
Session s = getSession();
AgentContext ac = s.getAgentContext();
Database db = ac.getCurrentDatabase();
db.updateFTIndex(true);
DocumentCollection dc = db.FTSearch
("arachnid", 15);
if (dc.getCount()>0)
{
Newsletter news = s.createNewsletter(dc);
Document doc;
Database reports = s.getDatabase
(null, "Reports.nsf");
for (int j=0; j<dc.getCount(); j++)
{
doc = news.formatDocument(reports, j+1);
doc.appendItemValue("Form", "Main Topic");
doc.appendItemValue
("Subject", "The Arachnid Report " + (j+1));
doc.appendItemValue("Categories", "Reports");
doc.appendItemValue("From", s.getCommonUserName());
doc.save(true, true);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}