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

Crystal 3 formula trick

Status
Not open for further replies.

lab00

MIS
Nov 19, 2003
8
US
I'm using the Crystal 3 formula trick to get totals of times elapsed by day of week: @MonAccum, @TueAccum, etc.
I initialize each one to 0 in the Group Header. My total variable for each is:

whileprintingrecords;
numbervar FriAccum;
{@FriAccum}

I have also done it:
whileprintingrecords;
{@FriAccum}

Data:
Group A
Mon 30
Tue 30
Wed 25
Wed 25
Thur 40
Fri 25
Fri 20

Group B
Mon 25
Tue 50
Tue30
Wed 20
Wed 15

This works find except on the total for the last day of the week represented in the data:

I get:
Group A
Mon 30
Tue 30
Wed 50
Thur 40
Fri 65

Group B
Mon 25
Tue 80
Wed 50

So it is adding the last one again if the day I am calculating is the day of the last records.

HELP please. Anyway to avoid this?

Thanks,

Lu Ann
 
Sow your other two of the "3 Formula Trick" and indicate where you place them on the report

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
lab00,

I have never referenced the other formulas when using the Initialize, Accumulate, Display approach -- I wouldn't think this would be the cause, but always worth a shot. I always just reference the variable itself in the final formula.

Failing that, as per CoSpringsGuy above, we will need to see your formulas (likely just all three for one set, ie Friday's three formulas) in order to assist you further.

Cheers!

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."
 
Make sure you are not calling the accumulating formula in the Group Footer. The Group footer should only declare the variable.

A simpler technique (instead of variables) is to create a formula for each DOW that returns the value if the record is for that DOW and zero otherwise. Then, simply sum that formula.

hth,
- Ido

view, export, burst, email, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top