I have the following calculation. It returns the total number of days associated with a schedulable object (_DayOff):
import System static def GetAttributeValue(_DayOff): totalDayCount = 0.0 if _DayOff.Appointments.Count> 0: for instance in _DayOff.Appointments: localTimespan = instance.EndDatetime - instance.StartDatetime localDayCount = 0.0 localDayCount = localTimespan.Days + localTimespan.Hours / 24.0 + localTimespan.Minutes / 24.0 / 60.0 totalDayCount += localDayCount Value = 0.0 Value = Math.Round(totalDayCount, 2) return Value
I am using the following dependencies:
Appointments/StartDatetime Appointments Appointments/Deleted Appointments/EndDatetime
(I added #2 and #3 for testing but they didn't help)
The calc is running perfectly when I add an appointment and when I change the start or end times within an existing appointment. But it doesn't seem to be firing at all when I delete an appointment.
Syntax checker comes out fine, and Test Calculation always returns the correct value.
I even tried adding a condition to see whether instance.Deleted != null but that didn't help me either.
The above behavior is reproducible across all calculations based on this Appointments collection. Am I missing a dependency?