all groups > sql server reporting services > may 2007 >
You're in the

sql server reporting services

group:

custom code to populate parm default


custom code to populate parm default ppbedz
5/1/2007 5:24:03 AM
sql server reporting services:
I am using custom code to retrieve the current year to populate the default
year parameter for a report. The custom code correctly retrieves the year
when tested within the body of the report. However, when referenced as an
expression code.CurYr in the "default" seection of the report parameters, it
causes the preview pane to grey-out the prompt. I can not enter anything in
the prompt and it does not contain a value. When I remove the custom code
from the expression for the "default", the prompt is white and available to
me for entry. Does anyone have any idea why this is happening, or how I can
default the current year into my prompt parameter?

Re: custom code to populate parm default toolman
5/2/2007 11:25:02 AM
[quoted text, click to view]

I don't think you need to use custom code. Using a date part function
that SSRS will accept should do the trick. Try =YEAR(getdate()) or
=YEAR(now())
Re: custom code to populate parm default ppbedz
5/2/2007 12:24:04 PM
=year(now is acceptable , HOWEVER, the preview pane still greys-out the year
prompt and does Not let me enter anything. It also does Not display the
results for the =year(now expression

For some reason, the preview pane doesn't work properly when an expression
provides the default value. In the past, I have specified a specific default
value, or used a query to load and had no difficulty.

Thoughts?

[quoted text, click to view]
Re: custom code to populate parm default toolman
5/3/2007 9:58:26 AM
[quoted text, click to view]

Apparently once you establish an expression as your default that's
what you get without options for editing.
The way around it (although it bugs me to have to jump the extra
hoops) is as follows.
Create a new Text type dataset and enter this query SELECT
year(getdate()) AS 'Year'
In the Parameters dialog, set the default to From query and use the
new dataset. This plugs in the year but allows it to be edited.
Re: custom code to populate parm default ppbedz
5/3/2007 10:58:00 AM
Got it... Thanks! :)

[quoted text, click to view]
AddThis Social Bookmark Button