質問

I have an SSRS 2005 report that has a dataset for to an Oracle database. The report that i have essentially just pulls all data back from an audit log. This report works perfectly fine and i have scheduled thi to run and send an email using the new subscription method within SSRS.

The only issue i have is i want the report to run on the last day of the month (its set up to do this alreday) and run the report based on that month only. Getting the report to run specifically for a month is what im unsure on? I though i would be able to set parameters within the report but these only enable my user to select a calendar date?

Is there a DATEADD or DATEPART type of function i can use to complete this task?

Regards B

役に立ちましたか?

解決

Best bet would be to set up a dynamic date default for the date patameter at the report level, and set up the subscription to use this default value, so whenever the subscription runs it would automatically have the appropriate date.

Probably the easiest thing to do is set the parameter as the current date, if that would work, e.g. something like =Today(). So that will be calculated whenever the subscription runs.

You can set the default value for whatever you need; first day of the current month, etc. You should able to set whatever value you need without too much trouble.

So for the first day of the month something like:

=DateSerial(Year(Today()), Month(Today()), 1).

Users running the report ad-hoc could just reset the parameter as required.

I'm assuming the report handles the amount of data to return correctly assuming the right data parameter is sent.

他のヒント

2 Parameters @DateFrom and @DateTo

Default Value for @DateFrom that outputs the first day of the current month:

=DateAdd("d",-Day(Today())+1,Today())

Default Value for @DateTo that outputs the last day of the current month:

=DateAdd("d",-Day(Today())+1,DateAdd("m",1,Today()))

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top