Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shared variable from subreport to main report 1

Status
Not open for further replies.

buffdaddy619

Technical User
Jan 12, 2010
10
US
Hello,

I created a report in Crystal 2008 and need some help. I have a subreport that generates a total by specialty. For examples:

Subreport
GF1 Allergy = 13160
GF1 EMERGENCY = 93308

I created a shared variable on the subreport to call onto my main report

@shared wrvu = //subreport
whileprintingrecords;
shared numbervar x := Sum ({@wRVU}, {PMG_BUDGET.SPECIALTY});

I linked my subreport to my main report using 3 parameters:

1. Start Date
2. End Date
3. Specialty

I placed the subreport in the Report Header of the main report (not surpressed or hidden).

I then created a formula to call the shared variable from the subreport to my main report:

@shared wrvu = //main report
whileprintingrecords;
shared numbervar x;

I then place this formula in GF1 which is grouped by specialty. When I run my main report for the specialties "Allergy" and "Emergency" the only number i get back from the subreport is for "Emergency". I can't seem to figure out why that is.

Any help would be appreciated. Thank you.
 
A linked subreport in the report header will only pick up on the first linked value of the main report. Instead, place the subreport in the specialty group section of the main report. If you link on specialty, you won't need the shared variable at all--unless you want to work with the value in the main report. You can just suppress all sections within the sub except the value you want displayed.

-LB
 
Thank you for your input. I placed the subreport into the specialty grouping (GH1). However I am still only seeing the last value of the subreport placed on the subreport.

Example: I am only seeing the number for Pediatric Surgery.

Subreport
Dermatology 35,310
Endocrinology 14,246
Nephrology 10,581
Pediatric Surgery 44,630

I guess I must be missing something.

Any help is appreciated for this. Thank you for your time.
 
You have to link the sub to the main report on the specialty field. Go to edit->subreport links and create the link there.

-LB
 
That did the trick. The reason I was having an issue was because I was joining the sub-report using the specialty parameter field on both the main report and the sub-report.

When I linked the specialty parameter from the sub-report to the specialty field of the main report it worked like a charm.

Thank you lbass for all your help. There is no way I could have done this without you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top