Thursday 30 January 2014

SSRS: How do Dates Appear in Parameters?

Source:

The Question - How do Dates Appear in Parameters?
For the fairly simple SSRS report shown below, the user has to enter a date as a parameter:

You can type in a date, and the report will show all actors in the underlying database born on or after that date.
The question is: how can you influence the date format?  First I'll give an answer, and then explain that it doesn't seem to work, and in any case answers the wrong question.

Changing the Date Format for Report Parameters

The best way to do this - says everyone - is to change the report's language, and to do that you need to change the report's properties:
Click completely off the report (on the slightly shaded area above, below or to the left or right of your design) to select the report.
You should now see the properties of the report in the Properties window, and can change the language setting:

You can set the property of the report to a specific language by choosing it from the list.
A better option is probably to set an expression for the language:

You can click in the Languageproperty and choose to set an expression.
You can then choose to change the language to that set on the report author's computer:

Click on Built-in Fields as a category, then double-click onLanguage to get the expression shown.
All of this is very interesting, but there are two problems with it: it doesn't seem to work, and it won't have any effect on the date format when you deploy your report. 

 Does the Language Setting Work?

After making the change above, nothing seems to alter:

The format of the report parameter is still not correct!
Can anyone help?  Why can't there just be a single setting saying: "show my dates in this format"?

What Happens when you Deploy a Report

When you deploy your report, it's the date settings of the client browser (in this case, IE9) which take effect:

The date is now perfect (for the UK format I want to use).
Weirdly, though, you can no longer click on the month header to change the year, decade or century, as you can in SSRS preview view.
So perhaps the moral is: don't fuss too much about the date format when you're authoring reports, and just make sure it looks OK when you deploy them.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home