Sunday, March 25, 2012

Computed parameters for subscribed & scheduled report?

Hi folks,
I've done some experimenting with the SQL Server Reporting Services and
like them very much.
However, I now have a problem I wasn't able to find a solution for: I need
to create a monthly report about my company's sales. I've set up my
subscription so that the report is mailed (as pdf) on every Monday in the
new month's first week.
Of course, I want to have the *LAST* month reported, not the current one,
so I'd need to compute the start- and end date of the report (which are
parameters). How can I do that?
Thanks!
JensCheck out the DateAdd function at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaorivbruntimelibrarykeywords.asp
roland|||I had exactly the same need (actually who doesn't! this should be easier ..)
and finally decided to write and external assembly that defines the ToDate
and FromDate based on relative periods stored in the DB (PeriodID passed )
The PeriodID allows me to find the calculation rule for taking today as a
starting point and start calculating relative Periods (range or single dates
( last month, last 3 month, first quarter, etc, etc.))
Sebastian|||In news:OtzAWWzYEHA.3564@.TK2MSFTNGP11.phx.gbl,
Sebastian Talamoni <sebastian.talamoni@.radventure.nl> typed:
> I had exactly the same need (actually who doesn't! this
> should be easier ..) and finally decided to write and
> external assembly that defines the ToDate and FromDate
> based on relative periods stored in the DB (PeriodID
> passed )
> The PeriodID allows me to find the calculation rule for
> taking today as a starting point and start calculating
> relative Periods (range or single dates ( last month,
> last 3 month, first quarter, etc, etc.))
> Sebastian
What I meant was: Don't provide any parameters on call. Schedule your
reports to run on every first of a month. Define defaults for the parameters
which calculate e.g. the first of the last month that way:
= new System.DateTime(Year(DateAdd(DateInterval.Month, -1,
Globals!ExecutionTime)), Month(DateAdd(DateInterval.Month, -1,
Globals!ExecutionTime)),1)
Other values in comparible manner, left to your phantasy :)
roland

No comments:

Post a Comment