AnsweredAssumed Answered

Calculation Evaluates as True Always

Question asked by jgomes384 on Mar 1, 2016
Latest reply on Mar 1, 2016 by jgomes384

I'm having trouble with this calculation:

Case ( DayOfYear ( Date ( 2 ; 29 ; PTOCalendar::Att_Year ) ) = DayOfYear ( Date ( 3 ; 1 ; PTOCalendar::Att_Year ) ) ;

ExecuteSQL ( "SELECT Sum ( Hours ) FROM AttendanceRecords WHERE EmpID = ? AND RecDate = ?" ; "" ; "," ; Extend ( PTOCalendar::E_ID ) ; Date ( 12 ; 31 ; Extend ( PTOCalendar::Att_Year ) - 1 ) + Get ( CalculationRepetitionNumber ) )

;

Case (

Get ( CalculationRepetitionNumber )  <  60

;

ExecuteSQL ( "SELECT Sum ( Hours ) FROM AttendanceRecords WHERE EmpID = ? AND RecDate = ?" ; "" ; "," ; Extend ( PTOCalendar::E_ID ) ; Date ( 12 ; 31 ; Extend ( PTOCalendar::Att_Year ) - 1 ) + Get ( CalculationRepetitionNumber ) )

;

Get ( CalculationRepetitionNumber ) = 60

;

0

;

Get ( CalculationRepetitionNumber ) > 60

;

ExecuteSQL ( "SELECT Sum ( Hours ) FROM AttendanceRecords WHERE EmpID = ? AND RecDate = ?" ; "" ; "," ; Extend ( PTOCalendar::E_ID ) ; Date ( 12 ; 31 ; Extend ( PTOCalendar::Att_Year ) - 1 ) + Get ( CalculationRepetitionNumber ) - 1 )

)

)

 

There's a lot there so, I'm specifically having trouble with the first Case test: DayOfYear ( Date ( 2 ; 29 ; PTOCalendar::Att_Year ) ) = DayOfYear ( Date ( 3 ; 1 ; PTOCalendar::Att_Year ) )

 

For some reason this statement is always evaluating as true and performing the calculation designated even when it should be false.

 

For instance, if Att_Year = 2015 then the test should be true, but if Att_Year = 2016 it should be false ( dayofYear 2/29/16 is 60 and dayofyear 3/1/16 is 61)

 

If anyone has any ideas why this is happening, it would be extremely helpful.

 

As an aside, I've inserted the test into DataViewer and switched between a 2016 record and 2015 record, DataViewer evaluates correctly.

 

Thanks,

Jason

Outcomes