Is there anyone who can give me a sample to help me understand how:
To create an agent that make a report once pr. month about the number of documents in a database with a specific information in a field.
My database contains quality complaints
I have a field with 3 status (0, 1 and 2)
Once pr. month I have to calculate the last 12 month reports with status 1.
If this number is >=12 then my rating is “black” = bad.
If the number is <12 then I have to calculate the last 6 month reports with status 1.
I this number >=6 then my rating is “red” = danger.
I would like to have this agent to create an email and send a report about this to the quality management group. The best would have been if the agent created a “summary document”, stored this in the database and then sent an email with the report and a link to that summary document.
Get the collection of documents to analyze. Since the agent is only run once per month use NotesDatabase.Search to build a document collection rather than using a view (although either approach would work).
Iterate through the your collection and accumulate values for your calculation.
Build an email or a document containing the message that you want based on the data gathered in step 2 and your business logic.
This seems like overkill. You could just create a view of these documents, categorized by month, most recent first, with totals. Your agent can use a NotesViewNavigator to scan this view and read the totals from the first however many category entries, come up with a status summary (red, black, or colorless) and send this as a one-sentence memo to the quality folks along with a link to the totals view.
Thanks for your input and it seems good as a start for me. However, the 12 month period is “floating” so I need to calculate from now (March 2008) and back to April 2007 for my report. Therefore catagorizing by month is not quite correct.