Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Passing report parameters without user selection

Author  Topic 

jrapp
Starting Member

9 Posts

Posted - 2005-02-23 : 16:03:02
In several instances I have situations where I would like to pass a value to the report without having the user select a parameter and without filtering the SP result set (because the SP is used for multiple reports). I have attempted to set the variable to a default in the SP, for example:

CREATE PROC NewReport
@ReportBeginDate datetime = Getdate

but RS just ignores the default value. I can set a default value in the Report Parameters page but each report parameter setup in this fashion requires user intervention at run time (or so I think). Has anyone figured out how to pass a parameter without user intervention and without modifying the SP?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-02-23 : 16:19:52
Why even bother with a report parameter then? Why not just capture today's date and time and put it in a calculated field?

Tara
Go to Top of Page

jrapp
Starting Member

9 Posts

Posted - 2005-02-23 : 17:36:18
Hum. Exactly. I don't want to use a report parameter. The GetDate example was a bad example. Here's a better example. I have an SP that pulls fruit. I have one report that should show apples and oranges and another report that pulls bananas. I want to use the same SP. I don't want the user to select a report parameter because only one condition (data set) is correct per report. The type of fruit is not a field on the report to use the IIF statement. I can add a grouping and hide groupings of particular types or create multiple tables and hide the tables with undesired types...but ideally, I would like to get the Filter tab to work....
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-02-23 : 18:21:33
It doesn't have to be a field in the report though. It can be a calculated field that you reference in other fields. You can even pass this calculated field into subreports or jumpto reports.

Tara
Go to Top of Page
   

- Advertisement -