I am currently working on a DB that stores a list of sales reports that get produced by the sales org in a simple table.
The reports produced regularly are classified as daily, weekly, monthly, or quarterly, and depending on the type, there is some additional information captured (i.e. for weekly reports, what day of the week they are produced).
I have successfully created a query that takes a date entered on a form by the user, and returns all reports that should be produced that particular day including the daily, weekly, monthly etc. in a report.
Now I want to be able to run this same query & report for either a range of dates entered by the user, or have the user enter one date, and have the report generate all the sales reports for the next 30 days.
Can I somehow iterate through my existing query in a loop between a begin and end date or is there a better approach to take?
The output should be arranged by date to form a forecast view such as:
Tuesday March 29, 2011
Daily Report 1
Daily Report 2
Daily Report 3
Weekly Tuesday Report 1
Weekly Tuesday Report 2
Monthly Report for the 29th
Wednesday March 30, 2011
Daily Report 1
Daily Report 2
Daily Report 3
Weekly Wednesday Report 1
Monthly Report for the 30th