Choose month or week or day in a parameter in a subscription

  • Hello,

    I've developped a report in SQL Server Reporting Services.

    There are 2 parameters in this report (2 dates) because a need to print a list of actions between these two dates.

    I want to create 3 subscriptions in order to receive it

    - on friday for the actions of the last 7 days

    - daily for the actions of the last day

    - monthly for the action af the last month

    How can i define the parameter in my subscriptions to make it possible ? (Actually i've developped 3 differents reports with 3 differents defaults values i've got a report for the day, one for the week and another one for the month), it's more difficult to update when i need to change it because i need to change 3 reports.

    So my aim is to use only one report and to create 3 subscriptions when i can put my parameters :

    1 : =CDate(DateAdd(DateInterval.Month,-1,Today) & " " & TimeOfDay())

    2 : =CDate(DateAdd(DateInterval.Day,-7,Today) & " " & TimeOfDay())

    3 : =CDate(DateAdd(DateInterval.Day,-1,Today) & " " & TimeOfDay())

    Thanks

  • If you have the enterprise version you can use data driven subscriptions using one report with 3 subscriptions.

    For yesterday your data driven subscription would be something like

    SELECT DATEDIFF(dd,-1,GetDate()) AS FromDate, DATEDIFF(dd,-1,GetDate()) AS ToDate

    For last week it would be something like

    SELECT DATEDIFF(dd,-7,GetDate()) AS FromDate, DATEDIFF(dd,-1,GetDate()) AS ToDate

    For last month it would be something like

    SELECT DATEDIFF(m,-1,GetDate()) AS FromDate, DATEDIFF(dd,-1,GetDate()) AS ToDate

    Then you take the FromDate and ToDate from your data driven subscription query and use them as the parameter inputs for your report. Your report can be developed with a FromDate and a ToDate input parameter with no expressions needed.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply