Well, this is fun and part of what I have done so far until I read that some people claim that this is impossible to do because of the default behavior of SSRS handling of default values. However, I got pretty far, and I'm curious if I can bring it all to the end.
Problem. I want the user to get PRE DEFINED between statements like "This Month", "LastMonth", etc ... Then he populates the DateTime variable for this string link, but the user can change it later, and he needs to update based on the parent line or let the user select another SINGLE DATETIME PARAMETER parameter.
To start working, that will work and will not:
I am. I bind the data set to this short form:
select 'Today' as Description , DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) BegDt union select 'ThisMonth' , Dateadd(month, Datediff(month, 0, getdate()), 0)
II. Then I set the “DatesPeriod” parameter, and then add the “Description” as the field and label for the parameter when I select “get values from the query”. The user can now select Today or ThisMonth from the drop-down list.
III. Now I have set up another dataset and call it "DatesSelected". For the purpose of explanation, I will keep it simple and just nest the data set from part I, but list the where clause. Essentially, I'm using the same dataset again, but forcing me to return one row at a time.
select * from ( select 'Today' as Description , DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) BegDt union select 'ThisMonth' , Dateadd(month, Datediff(month, 0, getdate()), 0) ) as x where x.Description = @DatesPeriod
IV. I define another “Start” parameter, which is then a DateTime and gets its values from the dataset above, as well as its default values. Now, when the user changes the first text variable, the dependent variable DateTime will also change. I linked the text selection essentially to a datetime variable, which is now limited in scope to only the available value and the default value for the description. This limits the scope to unity, forcing to transmit by default.
V. This is not enough, but I want the user to be able to choose FREE DATA DATES at his discretion. The current setting DOES NOT allow this button to select the date to be used, since the scope is limited by the available values. However, this must be done in order to pass the text to the datetime variable, which will update ON DEMAND (when it will be changed at the time the report is run, and not just the first time). So I create another DateTime parameter and call it “UserStart” and should default to “[@Start]” to get its default value as a dependency on “Start”.
VI. Now I am creating a test data set called "Selection" to visually see that my data is presented in the same way as I am.
Select isnull(@UserStart, @Start) as Choice
VII. I create a table object and put it in my report and put it in the single cell above to see that when the user overrides the default “Start” value of his choice (from the calendar display offered by SSRS) that he will display.
So, everything works with the coven at this moment. You need to display the BOTH datetime data so that the end user can choose either the default set or choose his own. If I try to hide the second “Start” parameter, it will set the default value only at the FIRST TIME when the report is executed, I want it every time the first parameter changes. If it is visible, it works fine, but for functionality, I would not want the user to see two report parameters that, as far as they are relevant, are the same. I tried my own code to return the Start parameter, creating another dataset, but as far as I know, SSRS is created so as not to be flexible with the default update or ANY DATE you want to select. If you want to update a parameter and do it on the screen with a different variable, you need to tell it the available values and the default values are changed. However, this eliminates the possibility of a calendar, so you need to pass the parameter to another parameter. However, if you hide the second parameter, then it will not pass the value.
Any help would be greatly appreciated.