December 16, 2009 at 2:24 am
Hi,
I have not been able to find an answer to this anywhere.
I have a report that is trying to assign traffic lights to different exposures in a portfolio.
For each exposure I have a flag for a "sector" to say in which sector a particular counterparty works. I have targets for sectors and if the portfolio falls outside of the targets, a flag should become active and ALL exposures in that particular sector should be marked with that flag.
In order to sum the exposures in each sector, i have written another report which uses a parameter to determine the sector i want the total exposure to be calculated.
This subreport is now embedded in the main report and the sector for each exposure is passed to the subreport. So this works perfectly well.
Now, my problem is that my subreport returns a value that I cannot refer to in any way. So say my subreport name is 'Sector' and the field name is "Sum_NBV" - in my main report I would like to say sth like '=ReportItems!Sum_NBV.Value' or maybe '=ReportItems!Sector.Sum_NBV.Value'
but it doesnt seem to work
Any ideas?
Thanks
Konrad
December 16, 2009 at 8:28 am
I don't think you can reference a value from a subreport in a main report.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
December 18, 2009 at 3:40 am
Actually you can, I've just done it after a bit of scrabbling about; it doesn't seem to be listed anywhere on the web!
What you'll need to do is put in an absolute reference, like so: [Reports]![YourReportName]![YourSubReportName]![TheValueFromTheSubReportYouWantToReference].
Worked for me anyway - I think it's because you can only reference open reports/forms, so you can't point straight to the sub report as it isn't open on it's own terms, you have to reference it as it currently exists through the main report.
Hope this helps. 😉
December 18, 2009 at 4:47 am
ok this is interesting, but cant get it to work
what do i put into an expression when:
-my report is called: Traffic_Lights.rdl
-my subreport is called Sector.rdl
-the subreport item i want to reference is called Sector_Score.rdl
i was thinking of
=[Reports]![Traffic_Lights]![Asset]![Asset_Score.Value]
but that doesnt seem to work
December 18, 2009 at 4:52 am
Ah, well, first off I'm coming at it from an Access SQL point of view, so what works there may not work elsewhere... but, try losing the last bit where you specify the value, I think it should choose the value by default. But again, that works in Access, my knowledge of more general SQL is limited.
December 18, 2009 at 4:58 am
it seems to have a problem with [Reports] - its an unrecognized identifier
December 18, 2009 at 5:03 am
Ah, that would have been the Access slant - is it working now?
December 18, 2009 at 5:10 am
yhh no
i kinda dont know how to refer to a report
i can refer to an item in the active report by using reportitems!
but refering to a different report needs a different class/identifier which i do not know
December 18, 2009 at 8:28 am
Hi.
If your sub-report is just that, and you want it to show the detail information of a PO#, then you should be able to use the Master/Child link properties of the sub report object. To get to the subreport object, bring up the main report in Design view, then click ONLY ONCE on the subreport. Then open the Properties window and it should say that it is for a subreport (Subform/Subreport, and the name of the subreport object. Under the Data tab, you will find the Master and Child Link properties. Here is where you would put the name of the PO# as found on the Main report (Master Link) and the name of the PO# as found on the subreport (Child Link).
By the way, I want to say that you can have a try of RAQ Report to make main-sub report easily. It provides 3 kinds of main-sub report for web report developers, Single-Table Main-sub Report, Embedded Main-Sub Report and Imported Main-Sub Report.
If you like, you can get a free edition at http://www.raqsoft.com/download/install-package/.
Regards,
becklery.
December 18, 2009 at 9:25 am
hi
thanks for your help but i think this is for ssrs2008 and i only have the 2005 ver
will try it out when i get a new one though
unless you find a way of doing the same thing in 2008
cheers
December 25, 2009 at 7:27 pm
You need to use a Shared variable.
In the subreport create a formula that contains/calculates the value you want to pass across. Something like
Code:
Shared currencyVar TotalAmount := Sum ({[Order Details].Amount});In the main report create a formula that uses this shared variable. Something like
Code:
Shared currencyVar TotalAmount;
If TotalAmount > 1000 then
TotalAmount * .1
Else
TotalAmount * .05Both formulas must use the exact same variable declaration. See the help file for more info on creating variables.
January 6, 2010 at 2:22 am
this sounds like a great idea, thanks man
will try it out later today/tmr and report back with any feedback here
January 6, 2010 at 8:24 am
OK
it doesnt work for me
Here's what I've done:
in the subreport, I added the following code:
public shared function region_score() as single
report_score=reportitems!textbox1.value
end function
in the main report, I added the following code:
public shared function subreport_region_score()
subreport_region_score=region_score
end function
and i got the following error:
Name 'region_score' not defined
Any solutions? What have I done wrong? Can this be done?
Also, I have done some google'ing and found one (but only one) website telling me that one cannot share variables between reports.
Wrrr
Maybe switching to SSRS 2008 would solve all this.
March 8, 2010 at 5:28 am
becklery (12/18/2009)
Hi.If your sub-report is just that, and you want it to show the detail information of a PO#, then you should be able to use the Master/Child link properties of the sub report object. To get to the subreport object, bring up the main report in Design view, then click ONLY ONCE on the subreport. Then open the Properties window and it should say that it is for a subreport (Subform/Subreport, and the name of the subreport object. Under the Data tab, you will find the Master and Child Link properties. Here is where you would put the name of the PO# as found on the Main report (Master Link) and the name of the PO# as found on the subreport (Child Link).
Where do you find Master/Child link properties? Can anyone explain more clearly how to do this, I have SSRS 2008.
March 8, 2010 at 5:29 am
konrad.blocher (1/6/2010)
OKit doesnt work for me
Here's what I've done:
in the subreport, I added the following code:
public shared function region_score() as single
report_score=reportitems!textbox1.value
end function
in the main report, I added the following code:
public shared function subreport_region_score()
subreport_region_score=region_score
end function
and i got the following error:
Name 'region_score' not defined
Any solutions? What have I done wrong? Can this be done?
Also, I have done some google'ing and found one (but only one) website telling me that one cannot share variables between reports.
Wrrr
Maybe switching to SSRS 2008 would solve all this.
Did you ever work this one out as I've been searching a lot for this and still can't work out what to do.
Thanks
Viewing 15 posts - 1 through 15 (of 17 total)
You must be logged in to reply to this topic. Login to reply