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!

Passing a "sub total" from a shared variable in a sub report. 1

Status
Not open for further replies.

RobbieB

Technical User
Apr 25, 2003
215
US
Hi, I am using crystal 8.5 on XP professional. I writing a commission report for photographers where the main reports date parameter is on "post_date" and the sub report is on "date_shot" to show how many days they worked in the past two weeks (pay period) with the main report showing posted sales in same two week period. I am grouping both the main and sub reports by photographer and they would like to be able to divide the "Total Sales" by the number of days worked. To get the number of days worked in the sub report I am using the following formulas:

this formula is in the sub-report report header:
whileprintingrecords;
shared numbervar DW;
DW = 0

this formula is in the sub-report detail section:
whileprintingrecords;
shared numbervar DW;
If (onFirstRecord or ({AXS_PHOTO_CATALOG.TAKEN_DATETIME})<>Previous({AXS_PHOTO_CATALOG.TAKEN_DATETIME}))
then DW:= DW + 1

this formula is in sub-report GF1 (grouped on Photographer):
whileprintingrecords;
shared numbervar DW;
DW

This works great for passing a total to the main report but, I want to have it reset for each photographer. The sub-report is in the Photographer group footer in the main report.
any ideas would be welcome. Thanks, Rob
 
Move the report header and report footer formulas to the Photographer group header/footer.

-k
 
Thanks K, I should have mentioned I have already tried that and it still creates a sum instead of returning the variable to "0".
 
OK, got it:

whileprintingrecords;
shared numbervar DW;
DW = 0

change to

DW :=0

-k
 
Man I hate when I do things that stupid...I wonder how much longer I would have looked at this report until I saw that. That fixed it! Thanks SO much for your time. I'm gonna go eat some humble pie now.....
- Rob
 
I found it quickly because it's one of my common hiccups as well...

Glad that resolved.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top