Dblank,
You are right. I had already tried the ELSE IF but as you say, I need to do all three every time as I go down name by name reading each record in the history file to see how much Sick time they have accumulated, used and also sold. The trouble I am having is that all of the transactions are in the same record. So I have to use a formula to say if they are type A, U or S so then and I cant do a Running total on a Formula field
here is the original formula I wrote to try to put them all in one
I put this formula in the detail section and supressed the section so it does not print
fmSickAccumulate
This is what was in that formula
whileprintingrecords;
global numbervar SickTrans;
if {HTOTRN_TRANS.HTODGR-GRP-CODE}='1'
and {HTOTRN_TRANS.HTOTRN-LTD-RECORD} = "N"
and {HTOTRN_TRANS.HTOTRN-TYPE}="A"
and {HTOTRN_TRANS.HPAHDM-ID} <> 0 then
SickTrans := SickTrans + {HTOTRN_TRANS.HTOTRN-HRS}
else
if {HTOTRN_TRANS.HTODGR-GRP-CODE}='1'
and {HTOTRN_TRANS.HTOTRN-LTD-RECORD} = "N" and
{HTOTRN_TRANS.HTOTRN-TYPE}="u" then
SickTrans := SickTrans - {HTOTRN_TRANS.HTOTRN-HRS}
and (I also tried ELSE here)
if {HTOTRN_TRANS.HTODGR-GRP-CODE}='1'
and {HTOTRN_TRANS.HTOTRN-LTD-RECORD} = "N" and
{HTOTRN_TRANS.HTOTRN-TYPE}="s" then
SickTrans := SickTrans - {HTOTRN_TRANS.HTOTRN-HRS};
And I put this formula field in the Footer for Group 1 to actually print on the report
fmSickPrint
This is what was in that formula
Whileprintingrecords;
global numbervar SickTrans;
Also I then I put this formula in the Group 1 header to reset the total so it would start over with each last name (and the report is grouped by last name)
mfSickReset
This is what was in that formula
whileprintingrecords;
global numbervar SickTrans := 0
But it does not reset or add up right as it goes down the records.
It would be so easy in Excel but of course when you are working with a database and have to have selection parameters for date ranges and formulas for limiting the types it gets complex.
It is so amazing that you guys would be willing to take the time to try to help me. If and when I get this Crystal Reports thing learned, I assure you I will be in here with you helping others....
Cordell
Edited by Cordellv - 14 Jan 2009 at 9:16pm