开发者

How to set Default parameter for cascading parameter report?

I am trying to build a 2008 SSRS report so that it displays table based on start and end date parameters. But when I set the default values of these date parameters, it开发者_StackOverflow中文版 displays same records in my table regardless of what parameters I've chosen, since they are defaulted. So then I tried setting default values = available values, but this does the same thing. So how do I create cascading parameters so that table correctly filters based on date logic?

I have three parameters: "Parameter_Week", "Start_Date", and "End Date". All of these come from the same dataset where Parameter Week is in string format of "6/12/11 - 6/18/11" and Start Date is "6/12/11" and End Date is "6/18/11". There are 4 different records from this same dataset, which are always equal to the last 4 weeks.

And the table dataset only takes the second 2 parameters: Start and End Date. So I want this table to filter records based on these dates. However, I get the error below if I set Default values for these two parameters to "None".

The 'Start Date' parameter is missing a value.

(and Start and End Date parameters are Hidden, since only "Parameter Week" parameter should be visible.)

So to summarize, I've tried every combination for setting the Default values for these two date parameters. If I set Default values = None, then I get the error message above. But if I set default to anything else, then it always returns same records in table since they are defaulted.


Here's what I did:

  1. Create a dataset to determine list of weeks

  2. Create a parameter (@DateString) that sets it's available values from the new dataset, set the label and value fields to the DateString field (created from a string of concatenated dates (i.e. 6/12/11 - 6/18/11)).

  3. Create a 2nd data set that is almost the same as the first except add a parameter filter

     WHERE DateString = @DateString
    
  4. Create 2 parameters @Date1 and @Date2. Set visibility to Hidden. Get Values from a query and set the dataset to your 2nd dataset and the value field to your date1. Go to Advanced and select "Always Refresh." (do this for @Date2 change the value field to date2)

  5. Create a dataset for the table with date parameters:

     SELECT * FROM Events WHERE Date BETWEEN @Date1 and @Date2
    
  6. Create a table with the values from this dataset

  7. Run report and change parameters to the different dates and table gets updated as parameter changes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜