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!

Crystal report

Status
Not open for further replies.

pateriya

Technical User
Jul 23, 2009
3
US
In Crystal report I designed 2 sub reports; and then doing distinct count in each sub report for a string value. I like to add both sub count and display at main report footer
 
Hello All,

Please help me out,

In Crystal report I designed 2 sub reports; and then doing distinct count in each sub report for a string value. I like to add both sub count and display at main report footer, the main report does not display any data except parameter values. I need to pass shared variable in both sub report for distinct count and then add together to display in main report.

Thanks in advance
 
Following are so far I have done.

Sub report 1:

WhilePrintingRecords ;
Global NumberVar cnt1;
cnt1:= DistinctCount ({user_pce_detail.client});

Sub report 2:

WhilePrintingRecords ;
Global NumberVar cnt2;
cnt2:= DistinctCount ({patient_current_demographics.patient_name});

Man report:

WhilePrintingRecords ;
Global numberVar cnt;
Global numberVar cnt1;
Global numberVar cnt2;

cnt:=cnt1+ cnt2;


Problem: I am getting 0 zero count in main report, both sub report I am getting correct count. Please help me out.

Thanks;
 
Pateriya:

This should be able to be done with one Shared Variable (I'm unsure of the "Global" type). [smile]

In Main Report Header (Or a section above the 1st Sub-Report):
@VariableReset_DCount:
whileprintingrecords;
Shared NumberVar DCount:=0;

In Footer of Subreports (one forula field in each)
@VariableSet_DCount:
whileprintingrecords;
Shared NumberVar DCount;
DCount:=DCount + DistinctCount({user_pce_detail.client};

In the Main Report Footer:
@VariableDisplay_DCount:
whileprintingrecords;
Shared NumberVar DCount;

In the future, please use a more descriptive Thread Heading and include the version of Crystal Reports & the type of Database you are using, as this can sometime affect the solution to your question. [smile]

Hope this helps!

Mike
--------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure, in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
Author R.A. Salvatore via "Drizz't"
 
If you changed "global" to "shared" in all formulas, then your method should work, as long as the subreports are in RH_a and the calculation formula is in RH_b.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top