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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shared Variables in Subreports

Status
Not open for further replies.
Mar 19, 2003
57
US
Crystal Reports 9
Informix 7
No Authorization to create stored procedures nor views

Created a main report with two group sections on a ACD table

Group Header 1 (Grouped by ACD)
Group Header 2 (Grouped by Hour)
Detail (No Data)
Group Footer 2 (Summary of each ACD stats per hour)
Group Footer 1 (Summary of each ACD stats)

Created a subreport which links to the main report via date and ACD fields on a Agent Table. The subreport has the same structure as the main report

Group Header 1 (Grouped by ACD)
Group Header 2 (Grouped by hour)
Detail (No data)
Group Footer 2 (Summary of ACD stats per hour)
Group Footer 1 (Summary of ACD stats)

In the subreport, I have two shared variables. One is on Group Footer 2 and the other is on Group Footer 1. Both shared variables are based on running totals. I placed the subreport in the main report's Group Header 2 section. Also, made sure all the sections were supressed in the subreport. Also, the section where I placed the subreport in the main report is not surpressed. I placed the first shared variable (Shared Variable 1) to be displayed on the Group Footer 2 in the main report. This works fine. However, the second shared variable (Shared Variable 2), I placed in the Group Footer 1 section in the main report does not display the correct data. The second shared variable in the main report displays the last value from the other shared variable (Shared Variable 1) in Group Footer 1.

When I ran the subreport separately from the main report, The formulas - running totals and shared variables in the subreport works fine.

Below are the formulas I am using for the shared variables in the subreport:

Shared Variable 1
Whileprintingrecords;
Shared Numbervar agenthr := 0;
agenthr := {Running Total 1}

Shared Variable 2
Whileprintingrecords;
Shared Numbervar agentacd := 0;
agentacd := {Running Total 2}

Below are the formula used to display the shared variables in the main report:

Shared Variable 1 Formula:
Whileprintingrecords;
Shared Numbervar agenthr;
agenthr

Shared Variable 2 Formula:
Whileprintingrecords;
Shared Numbervar agentacd;
agentacd

What am I doing wrong?
 
You cannot place a subreport in Group Header 2 and think that Group Footer 1 formula should see the value. The formula in Group 1 will fire off before the subreport - giving you incorrect data.

Try placing the subreport into various section until you get the desired result - I have a hard time doing these things via a forum board!

I hope this helps

paulmarr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top