Friday, March 23, 2012

How to make a subscription use the default value for a parameter

Hi everyone,

I need to use the CreateSubscription method and have this new subscription use a default value for certain parameter. How can I do this?

I set a default value in the parameter settings when creating the report in Visual Studio.

-Marianne

|||

Hi Marianne,

I have to create the subscription programatically, which is different from what you mention. To further clarify my challenge:

I have three parameters in a report: date-interval (string), start-date (date), end-date (date). If the user selects for example "last week" as the date-interval, the DEFAULT values for the other two are as follows:

Code Snippet

start-date=DateSerial(Year(Today),Month(Today),Day(Today)-Weekday(Today)-6)

end-date=DateSerial(Year(Today),Month(Today),Day(Today)-Weekday(Today)-1)

The user can then select intervals like "today", "yestarday", "this month" etc, and the other two parameters are calculated based on that date-interval parameter. Now, If I programatically create a subscription to a report that contains these three parameters and set a value of "last week" for the date-interval parameter, the subscription stores the fixed days (say september 10 to september 16) producing a report of the same week every time the subscription is run and not updating the correct interval to LAST-WEEK!. What should I put as the value for start-date and end-date when I create the subscription to have these two params get the DEFAULT calculated value based on the third param date-interval?

Hope to have been more clear now.

|||

Cato,

I'm sorry - I'm no help there. It's something I'd like to know how to do, as well.

-Marianne

No comments:

Post a Comment