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!

Passing a Shared Variable to the Main Report 1

Status
Not open for further replies.

beth4530

Technical User
May 5, 2011
44
US
I have a shared variable formula in my subreport as
Shared numberVar ClientsServed :=DistinctCount ({Patient_Clin_Tran.patient_id}, {@CSPP})
The formula is placed in the group footer of the subreport. The formula in the main report is written as Shared numberVar ClientsServed;
When the ShVariable formula is placed in the main report group footer the number is correct…however it's for the group above it! The first grouping shows up as 0 and the second grouping shows the first grouping total and so on. How do I correct this? There is only one group in both the subreport and the main report and they are grouped on the same field.
 
In the main report, insert another group footer section and place the shared variable formula in the GF2_b. The sub should be in GF2_a. A shared variable will only have the correct value in a section below the one in which the sub is placed.

You can format GF2_a to "underlay following sections" if you wish.

If you don't have a reset formula, add one in the main report Group #2 header:

whileprintingrecords;
shared numbervar ClientsServed;
if not inrepeatedgroupheader then
ClientsServed := 0;

This will prevent groups from taking on the values from previous groups when the sub is null (if it can be).

-LB



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top