Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Reporting Services / June 2008

Tip: Looking for answers? Try searching our database.

Passing Subreport Value back to Main Report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
calvint - 29 May 2008 01:47 GMT
Hi,

Does anyone know how to use a value from the subreport in the main report to
do calculations? Crystal has this functionality, but it doesn't seem like
SSRS has it.

Pls advise.

Thanks,

Calvin
Antoon - 29 May 2008 13:51 GMT
Create a parameter for the value in the main report
From the sub-report call the main report with the value in theat parameter

> Hi,
>
[quoted text clipped - 7 lines]
>
> Calvin
calvint - 29 May 2008 22:25 GMT
Hi Antoon,

Can you elaborate a bit further on that?

Thanks,

Calvin

> Create a parameter for the value in the main report
> From the sub-report call the main report with the value in theat parameter
[quoted text clipped - 10 lines]
> >
> > Calvin
Antoon - 30 May 2008 07:32 GMT
Ok, so you have a main-report and a sub-report.
I presume you want the user to click on some item in the sub-report and then
use the value of that item in hte main report.
Fe the subreport contains a list of names, you click on a name and then the
main report filters it's value acoording to that name.

What you do is you create a parameter "Name" in the main report and give it
a default value (I always use -1 to indicate that I want to show the values
of all names). You define a filter in the main report fe
iif(Parameters!Name.Value = -1 or Fields!Name.Value =
Parameters!Name.Value,1,0) = 1

In the subreport, on the item containing the name you add an action. The
action jumps to the main-report setting the parameter "Name" to the value of
the item that was clicked.

Hope this helps

Regards
Antoon

> Hi Antoon,
>
[quoted text clipped - 18 lines]
> > >
> > > Calvin
calvint - 30 May 2008 09:54 GMT
Hi Antoon,

Thank you for your reply.

I haven't actually added any filters or actions in before...so I may have to
try that out first.

What I would like, would be to use a value that the subreport brings back
(say 100) & use that in a calculation in a different field. Say one field is
300 & the field that contains the calculation is: 300 - 100 (subreport value)
= 200.

Will what you were saying before do that?

When I export the report to Excel, it says that Subreports within a table
are ignored...is there anyway to get that value to export into Excel too?

Thanks,

Calvin

> Ok, so you have a main-report and a sub-report.
> I presume you want the user to click on some item in the sub-report and then
[quoted text clipped - 39 lines]
> > > >
> > > > Calvin
Antoon - 30 May 2008 10:31 GMT
What I suggested will only work if you expect the user to click on something
in the sub-report.
If your sub-report is a cell in a table and you want it to automatically
return a value? That would be very difficult.
In that case I would suggest to calculate the "100" (in your example) in the
main-report (in the sql, if possible) and only use the sub-report to show fe
details of the calculation of the "100".

Export to excel of subreports in an table: sorry haven't tried that.

> Hi Antoon,
>
[quoted text clipped - 60 lines]
> > > > >
> > > > > Calvin
Snowball - 03 Jun 2008 19:25 GMT
You can not put a subreport into a table and export to Excel as you have
discovered.

You will need to use a list instead of a table in order to display the
subreport in your main report.  With a list, you still have the ability to do
grouping.
calvint - 11 Jun 2008 02:24 GMT
Thanks for that Snowball :-)

> You can not put a subreport into a table and export to Excel as you have
> discovered.
>
> You will need to use a list instead of a table in order to display the
> subreport in your main report.  With a list, you still have the ability to do
> grouping.
prabhupr@gmail.com - 27 Jun 2008 17:17 GMT
Iam not sure if you can pass values from Sub-Report to Parent-Report,
but here is another option. Read the Desired calues from a COMMON
place (XML File, SQL Table,...) & have this values updated based on
user action, ensuring you take care of default values incase values
are NOT SET or PASSED

> Thanks for that Snowball :-)
>
[quoted text clipped - 6 lines]
>
> - Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.