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

Can't Sum / Use Running Total?

Status
Not open for further replies.

FireGeek21

Technical User
Dec 12, 2007
218
US
Why can't I sum this or use this formula for a running total?

DateDiff("d", {PER_HX.EFFECT_DATE}, CurrentDate)




RSGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
More detail:

//LOA ON
IF {PER_HX.ACTION_CODE} IN ["ON LOA", "CHANGE LOA"] THEN {PER_HX.EFFECT_DATE}

//LOA OFF
IF {PER_HX.ACTION_CODE} IN ["ON LOA", "CHANGE LOA"] AND {PER_HX.EMPLOYEE} = Next({PER_HX.EMPLOYEE}) THEN Next({PER_HX.EFFECT_DATE})

//LOA DAYS
SUM(IF {@LOA Off} = Date(0, 0, 0) THEN DateDiff("d", {@LOA On}, CurrentDate) ELSE DateDiff("d", {@LOA On}, {@LOA Off}))


I want to do a SUM of the LOA DAYS field but get "A field is required here.

So, I broke it down to SUM(DateDiff("d", PER_HX.EFFECT_DATE, CurrentDate))

... which is when I get "A field is required here"

The idea is to put the LOA On/Off dates in an Group Header with the number of days an employee was on LOA. The detail then will be a list of course start/end dates and the number of days for that course to indicate whether or not the employee will be eligible for tuition reimbursement.


RSGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
You should have mentioned that in your first thread. You can't summarize formulas that use next() in the conventional way. You could use a variable to do this, but it would have to be displayed in the group footer, NOT the group header. My suggestion in your first thread was also based on using the detail section (not the group header) to display the LOA on/off dates.

-LB
 
LBass,

I am finding this out now. :(

But, interestingly, I can't even sum a datediff formula that doesn't use either of these formulas...

SUM(DateDiff("d", PER_HX.EFFECT_DATE, CurrentDate)) isn't working...




RSGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
You need to create the datediff formula separately and then in a second formula reference it:

sum({@datediff})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top