SSRS date default with formula disables parameter
Asked Answered
A

4

16

When I set a default value formula for a date parameter in SSRS, such as:

=CDate(”01/” & Month(Now) & “/” & Year(Now))

or even:

=Now

the date parameter control becomes disabled with nothing in it. Does anyone know what simple thing (I am sure) I am doing wrong?

Alderete answered 29/3, 2010 at 21:37 Comment(0)
A
26

After playing some more, I realized that the date controls became enabled when I picked a value from a preceding dropdown parameter that did not have a default. Apparently, controls after non-default parameters are disabled until you pick something, so order matters.

From an MDSN article:

"parameter order is important when you want to show users the default value for one parameter before they choose values for other parameters"

http://msdn.microsoft.com/en-us/library/cc281392.aspx

Alderete answered 30/3, 2010 at 13:14 Comment(2)
That was a really nasty thing! Just disabling controls without any messages or warnings is a horrible thing to do. Shame on Microsoft. Thanks for the good catch and helping me fix my blasted report.Synagogue
That's bad bad bad. Just started Reporting Services and thats not giving a good impression. I wonder how many other "rules" there we are supposed to magically know about?Gwalior
C
0

I experienced the same and the problems lies on the USER ID parameter that I set to internal visibility but without any default value. When I put in default value or set this to null, the date parameter was enabled.. (User ID parameter comes before the date parameter on my case)

Consider answered 24/1, 2020 at 2:54 Comment(0)
S
0

A solution to this is to set the default value using a dataset (i.e. the "get values from a query" option) instead of an expression ("specify values" option). Then the parameter is not disabled upon load and the report doesn't refresh after selecting the first parameter. I'm not sure why it works this way, but it fixed the issue for a SSRS report I was working on that had the same problem.

Example: add a "DefaultDate" dataset to your report datasets with this query, then update your parameter to use this dataset as the default value:

select defaultDate = convert(date, getdate())
Salivation answered 5/6 at 11:11 Comment(0)
O
-3

Now is a function and you must use like =Now()

maybe it is your problem.

Orgy answered 30/3, 2010 at 10:2 Comment(2)
Change to =Now() did not fix the issue.Alderete
You maze well delete this answer. It has nothing to do with the calendar control getting disabled. I gave you a 3rd downvote so if you delete you can at least get the peer pressure badge.Maldives

© 2022 - 2024 — McMap. All rights reserved.