How would I display consecutive item occurrences in a report?

Hello All,

I have n number of documents in my database and sorted by year.

Many documents have same Item created on different dates. I would like to find out how many occurrences for this item in a year.

Ex: Document1 created on 31/October/2008 with Item A

Document2 created on 3/November/2008 with Item A

Document3 created on 4/November/2008 with Item A

Document4 created on 6/November/2008 with Item A

As document1, 2, 3 are created on 31, 3, 4(Friday, Monday and Tuesday)…these are the consecutive days (documents will not be created on Saturday & Sunday and considered consecutive days) and the occurrence will be 1

The document4 is created on 6 (Thursday), which is non consecutive and it’s considered as a separate occurrence and counted as 1

And I would like to get the results: Occurrences for Item A for 2008 are 2 (1 for consecutive and 1 for non consecutive)

Could someone please guide me how to achieve this?

Thanks

Sri

Subject: How would I display consecutive item occurrences in a report?

I would build a view with the necessary columns. These columns must show at least the date and the name of the item.

Now use a ViewEntryCollection to scan sequentually through the collection and see if the new day has no gap with the previous day.

Build a list of item-nroccurrences during this process.

This algoritm should have an extra test to accomodate for Saturdays and Sundays. You may look for a Weekday-routine on the Internet.