Month wise Total Report

Hi,

I need to optimize the code I am using to generate a Report.

This is the requirement for the report.

For a given date range, points of associates should be totaled based on month and the associates should be grouped based on the Division they belong to. (Refer Sample below).

             Jan 07    Feb 07 .....                          Dec 07

Div1

 A1         10          20     0   .......                       0

 A2         12          25     0

SubTotal 22 45

Div 2

 A1         20          30     0   .......                       0

 A2         12          25     0

SubTotal 32 55

Grand Total –

Currently, I get the collection of point documents which fall in the given date range. I process each document and create a Temp document for each associate. The temp document contains fields to identify the associate, div code, each month total. This is then looked up in a view. Before creating the temp doc, I check if a docu for the associate is already present using div code and the associate id as key. If not I create a new doc. If its present then based on the month of the point document I add the point to that month total.

Using this logic, for a collection of just 800 documents it takes approximately 3 minutes for the report to get generated. Its really slow.

Can anybody out there suggest a logic which can improve the performance?

Thanks in Advance,

Reena

Subject: Month wise Total Report

Rather than compute a ‘temp’ document every time consider creating ‘snapshot summary’ documents via a daily/weekly/monthly agent and run your reports off those.

If you include an embedded view of the source documents in a form to display the document users can drill down for more detail.

HTH