Monday, March 12, 2012

Main report drive Subreports

Will SRS support passing parameters from the main report to the subreport
which calls a stored proc that does not contain any parameters ? it will
automatically filter the data without the where clause.
I used to be able to do this in Crystal reports which I don't need to
specify a where clause in my subreport stored proc and I am not sure if SRS
will support this and I hope that I don't need to rewrite all the stored proc
for this.
Need help on this one !
ThanksRS has two different ways of filtering the data. One is to use it as a query
filter. In this case the parameter would either part of the query or passed
to a stored procedure. SQL Server would then only return the necessary data
to the report. The other possibility is to use a filter. The filter has RS
filter the data. Whatever data is defined in the dataset goes to the report
and then the report filters the data. I stay away from this because it is
much more efficient for the database to send only the necessary records to
Reporting Services. However, it sound like you want to use filters.
You would do the following. Create a subreport with a parameter. Use the
parameter in your filter. When you embed the subreport into the report then
do a right mouse click on the subreport and map the report parameter to
whatever is appropriate on the main report.
So in your case the subreport has a dataset based on a stored procedure that
has no parameters. That dataset returns the data. Then using the report
parameter passed into it by the main report, the report takes the data from
the stored procedure and filters it.
Read up in book online on filtering. You can apply the filter in multiple
spots. The value you want to filter on would be an expression which is where
you would then reference the report parameter.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Eric Hu" <EricHu@.discussions.microsoft.com> wrote in message
news:132A8634-04DA-4688-8C40-F53513085D43@.microsoft.com...
> Will SRS support passing parameters from the main report to the subreport
> which calls a stored proc that does not contain any parameters ? it will
> automatically filter the data without the where clause.
> I used to be able to do this in Crystal reports which I don't need to
> specify a where clause in my subreport stored proc and I am not sure if
> SRS
> will support this and I hope that I don't need to rewrite all the stored
> proc
> for this.
> Need help on this one !
> Thanks|||Brian,
In my report parameter, it's either a single area or all areas. The filter
works good with one area, but when I select all areas I want to have all
recordset coming back. Is there a way to conditionally turn the filter on or
off ? I only need to filter if the user select a single area.
Thanks,
Eric
"Bruce L-C [MVP]" wrote:
> RS has two different ways of filtering the data. One is to use it as a query
> filter. In this case the parameter would either part of the query or passed
> to a stored procedure. SQL Server would then only return the necessary data
> to the report. The other possibility is to use a filter. The filter has RS
> filter the data. Whatever data is defined in the dataset goes to the report
> and then the report filters the data. I stay away from this because it is
> much more efficient for the database to send only the necessary records to
> Reporting Services. However, it sound like you want to use filters.
> You would do the following. Create a subreport with a parameter. Use the
> parameter in your filter. When you embed the subreport into the report then
> do a right mouse click on the subreport and map the report parameter to
> whatever is appropriate on the main report.
> So in your case the subreport has a dataset based on a stored procedure that
> has no parameters. That dataset returns the data. Then using the report
> parameter passed into it by the main report, the report takes the data from
> the stored procedure and filters it.
> Read up in book online on filtering. You can apply the filter in multiple
> spots. The value you want to filter on would be an expression which is where
> you would then reference the report parameter.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Eric Hu" <EricHu@.discussions.microsoft.com> wrote in message
> news:132A8634-04DA-4688-8C40-F53513085D43@.microsoft.com...
> > Will SRS support passing parameters from the main report to the subreport
> > which calls a stored proc that does not contain any parameters ? it will
> > automatically filter the data without the where clause.
> >
> > I used to be able to do this in Crystal reports which I don't need to
> > specify a where clause in my subreport stored proc and I am not sure if
> > SRS
> > will support this and I hope that I don't need to rewrite all the stored
> > proc
> > for this.
> >
> > Need help on this one !
> >
> > Thanks
>
>|||The filter is an expression. You should be able to do this.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Eric Hu" <EricHu@.discussions.microsoft.com> wrote in message
news:00C86BEC-B4EC-4A91-8E09-D4C549915CD7@.microsoft.com...
> Brian,
> In my report parameter, it's either a single area or all areas. The filter
> works good with one area, but when I select all areas I want to have all
> recordset coming back. Is there a way to conditionally turn the filter on
> or
> off ? I only need to filter if the user select a single area.
> Thanks,
> Eric
> "Bruce L-C [MVP]" wrote:
>> RS has two different ways of filtering the data. One is to use it as a
>> query
>> filter. In this case the parameter would either part of the query or
>> passed
>> to a stored procedure. SQL Server would then only return the necessary
>> data
>> to the report. The other possibility is to use a filter. The filter has
>> RS
>> filter the data. Whatever data is defined in the dataset goes to the
>> report
>> and then the report filters the data. I stay away from this because it is
>> much more efficient for the database to send only the necessary records
>> to
>> Reporting Services. However, it sound like you want to use filters.
>> You would do the following. Create a subreport with a parameter. Use the
>> parameter in your filter. When you embed the subreport into the report
>> then
>> do a right mouse click on the subreport and map the report parameter to
>> whatever is appropriate on the main report.
>> So in your case the subreport has a dataset based on a stored procedure
>> that
>> has no parameters. That dataset returns the data. Then using the report
>> parameter passed into it by the main report, the report takes the data
>> from
>> the stored procedure and filters it.
>> Read up in book online on filtering. You can apply the filter in multiple
>> spots. The value you want to filter on would be an expression which is
>> where
>> you would then reference the report parameter.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Eric Hu" <EricHu@.discussions.microsoft.com> wrote in message
>> news:132A8634-04DA-4688-8C40-F53513085D43@.microsoft.com...
>> > Will SRS support passing parameters from the main report to the
>> > subreport
>> > which calls a stored proc that does not contain any parameters ? it
>> > will
>> > automatically filter the data without the where clause.
>> >
>> > I used to be able to do this in Crystal reports which I don't need to
>> > specify a where clause in my subreport stored proc and I am not sure if
>> > SRS
>> > will support this and I hope that I don't need to rewrite all the
>> > stored
>> > proc
>> > for this.
>> >
>> > Need help on this one !
>> >
>> > Thanks
>>|||Thanks for the quick reply. I am not sure how to do this.
The way the filter works is that:
In Expression, type or select the expression for the field that you want the
filter to evaluate.
In Operator, select the operator that you want the filter to use to compare
the evaluated field and the value.
In Value, type the expression or value against which you want the filter to
evaluate the value in Expression.
Seem like you always need to assign a value to a filter, so in the case of
all values , I don't want to have a filter and how will this work with
expression ?
"Bruce L-C [MVP]" wrote:
> The filter is an expression. You should be able to do this.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Eric Hu" <EricHu@.discussions.microsoft.com> wrote in message
> news:00C86BEC-B4EC-4A91-8E09-D4C549915CD7@.microsoft.com...
> > Brian,
> >
> > In my report parameter, it's either a single area or all areas. The filter
> > works good with one area, but when I select all areas I want to have all
> > recordset coming back. Is there a way to conditionally turn the filter on
> > or
> > off ? I only need to filter if the user select a single area.
> >
> > Thanks,
> > Eric
> >
> > "Bruce L-C [MVP]" wrote:
> >
> >> RS has two different ways of filtering the data. One is to use it as a
> >> query
> >> filter. In this case the parameter would either part of the query or
> >> passed
> >> to a stored procedure. SQL Server would then only return the necessary
> >> data
> >> to the report. The other possibility is to use a filter. The filter has
> >> RS
> >> filter the data. Whatever data is defined in the dataset goes to the
> >> report
> >> and then the report filters the data. I stay away from this because it is
> >> much more efficient for the database to send only the necessary records
> >> to
> >> Reporting Services. However, it sound like you want to use filters.
> >>
> >> You would do the following. Create a subreport with a parameter. Use the
> >> parameter in your filter. When you embed the subreport into the report
> >> then
> >> do a right mouse click on the subreport and map the report parameter to
> >> whatever is appropriate on the main report.
> >>
> >> So in your case the subreport has a dataset based on a stored procedure
> >> that
> >> has no parameters. That dataset returns the data. Then using the report
> >> parameter passed into it by the main report, the report takes the data
> >> from
> >> the stored procedure and filters it.
> >>
> >> Read up in book online on filtering. You can apply the filter in multiple
> >> spots. The value you want to filter on would be an expression which is
> >> where
> >> you would then reference the report parameter.
> >>
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >> "Eric Hu" <EricHu@.discussions.microsoft.com> wrote in message
> >> news:132A8634-04DA-4688-8C40-F53513085D43@.microsoft.com...
> >> > Will SRS support passing parameters from the main report to the
> >> > subreport
> >> > which calls a stored proc that does not contain any parameters ? it
> >> > will
> >> > automatically filter the data without the where clause.
> >> >
> >> > I used to be able to do this in Crystal reports which I don't need to
> >> > specify a where clause in my subreport stored proc and I am not sure if
> >> > SRS
> >> > will support this and I hope that I don't need to rewrite all the
> >> > stored
> >> > proc
> >> > for this.
> >> >
> >> > Need help on this one !
> >> >
> >> > Thanks
> >>
> >>
> >>
>
>

No comments:

Post a Comment