0
votes

I am trying to update parameter value in ssrs report builder tool. say if i want to update value of parameter "datetime" and select a value from drop down, i am getting a dropdown instead of textbox . How to update a value of datetime when i change a value of another parameter ?

enter image description here

in the above image timeframe if change then the value should reflect in 'start' datetime field but it wont. The same works if i do it for dropdopwn i.e. startdate field if i change value in timeframe it changes in startdate but not in start datetime field.

Thanks

1
Did you set the params to reference the one before?Snowlockk
DateTime type parameters will not refresh/update like you expect; at least not real time in the dev tools, or Report Manager. However, what you are attempting will work when used in a report subscription.R. Richards

1 Answers

0
votes

Against the parameter you want to set like this, you need to set a default value. ParameterProperties Choose "Specify Value" and go into the expression builder.

Your expression will be something like..

=switch(Parameters!First.Value = 1, dateadd(DateInterval.Day, -1, today(), Parameters!First.Value = 2, Today(), 1=1, Today())

This looks for the value of the parameter called "First" (which will be your drop down called "TimeFrame") and updates the value of the current parameter based on that.

The 1=1 part is simply because I like a fake "else" in a switch (treating it like a case statement).

There is a bug with cascading parameters however. On first run, the default value will be updated. If you then change the value in "TimeFrame", the corresponding value in the datetime field will not update.

See here for more information:

https://connect.microsoft.com/SQLServer/feedback/details/268032/default-does-not-get-refreshed-for-cascading-parameters