I am trying to return the total number of regular hours a particular employee works during a date range.
I believe that I have the filter coded correctly but I'm having trouble trying to apply the aggregate. I looked at the documentation and figured that the GetScalar was the way to go but I'm not sure what to include in the 3rd parameter.
Can anyone help me see the light?
IPredicateExpression filter = new PredicateExpression(TimeOffHistoryFields.EmployeeId == employeeID);
filter.Add(TimeOffHistoryFields.TimeOffTypeId == RegularTime.TimeOffTypeId);
filter.Add(new FieldBetweenPredicate(TimeOffHistoryFields.Date, startDate, endDate);
TimeOffHistoryCollection totalHours = new TimeOffHistoryCollection();
hours = (int)totalHours.GetScalar(TimeOffHistoryFieldIndex.TimeOffTypeId, (TimeOffHistoryFields.Hours*1), AggregateFunction.Sum, filter);