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

Error Message in Work Days Formula

Status
Not open for further replies.

Shanna

Technical User
Apr 30, 2001
6
GB
Hi Everyone,

When I am checking the formula below in Crystal, I am encountering the following error ' A number, currency amount, boolean, or string is expected here' (at the point marked ***this is where the error is occuring**** in the formula below - just before the DaysOfWeek in the AbsDays1 definition ) however I can't see why this error should be happening. Can anyone advise why this is happeining and/or suggest how I can overcome this? Any help much appreciated! (I've only included the 1st part of the If statement as)

numberVar TotalAbs;
DateVar Begin := { X | SW_0009a_Monthly_Abs_By_Dept.BEGIN_DT};
DateVar Return := { X | SW_0009a_Monthly_Abs_By_Dept.RETURN_DT};
numberVar AbWeeks1; //week calc for abs begin and return in Jan
numberVar AbWeeks2; //week calc for abs return in Jan beginning < Jan
numberVar AbWeeks3; //week calc for Abs beginning in Jan & return > Jan
numberVar AbWeeks4; //week calc for abs begin < Jan return > Jan

numberVar AbDays1; //day adj calc for abs begin and return in Jan
numberVar AbDays2; //day adj calc for abs return in Jan beginning < Jan
numberVar AbDays3; //day adj calc for Abs beginning in Jan & return > Jan
numberVar AbDays4; //day adj calc for abs begin < Jan return > Jan

AbWeeks1:= (Truncate(Return - DayOfWeek(Return) + 1- (Begin - DayOfWeek(Begin) + 1)) /7)*5;
AbDays1:=***this is where the error is occuring****Dayof Week(Return) - DayOfWeek(Begin) + 1;

numberVar HolsJan := 1; //hogmanay holiday
numberVar HolsDec:= 2; //xmas, boxing

//for absences in January in the current year for working days

IF Month(Begin)= 1
AND Month(Return) = 1
AND Year(Begin) = Year (CurrentDateTime)
AND Year(Return) = Year (CurrentDateTime)
THEN
TotalAbs = AbWeeks1 + AbDays1 - HolsJan


.....


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top