SSRS Date/Time Parameter Disabled When Default Value Expression Is Used

,

After inserting a date/time parameter with an expression as its default value into a Microsoft SQL Server Reporting Services (SSRS) 2008 R2 report, I noticed that the date/time control would be disabled when I’d preview the report. Strange.

This problem only exhibits itself when the date/time parameter’s default value is an expression (say “=Now“). If the default value is not set or is set to a literal value (like “1/1/11“), the control functions as expected—it is enabled. Also, the date/time parameter must be preceded by another parameter. The other parameter must require the user to enter a value (null values disallowed, no default value set).

My Guess As To What’s Going On

The date/time control won’t enable itself until it evaluates its default value expression. It won’t compute this expression until the proceeding parameter has been set to a value (via user entry, a default value specification, or because nulls were allowed so the value defaulted to null). My guess is that this evaluation delay is intended to allow this parameter’s expression to use the proceeding parameter’s value in its computation.

Now that I’ve thought it through, this behavior makes sense—but it caught me by surprise at first.

Need help with a Microsoft SQL Server Reporting Services (SSRS) project? Drop me a line!

5 thoughts on “SSRS Date/Time Parameter Disabled When Default Value Expression Is Used

  1. bruce

    Thanks for the information, but another problem is when we use SOAP to call SSRS service, the default value in SSRS is ’31/1/2020 12:00:00 a.m.’, but the value return from SOAP service is ‘1/31/2020 12:00:00 AM’, which can’t be formatted by DateTime.ParseExact() method.

    Reply
  2. Mike Krausnick

    Thanks for this post – it helped me a lot. I experimented and discovered that if the default value comes from a dataset instead of an expression, the dataset is not disabled. In my case, parameter 1 was a date with a fixed default value and parameter 2 was a date with a default value defined by an expression, not dependent on parameter 1. Since it was not dependent on parameter 1, I thought there was no reason for it to be disabled.

    I think this is a bug, but anyway, the workaround is to use a dataset for the default value, and put the expression in the query expression of the dataset.

    Reply
  3. Pingback: SSRS Date/Time Parameter Disabled When Default Value Expression Is Used | petersnotebook

  4. John Kautzner

    Thank you for writing this post, Ben. It’s really nice to see an explanation of the exact issue I’m looking at. You saved me a lot of time.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *