LPARAMETERS toScheduleObject LOCAL lnBarColor, liStartTime, liEndTime , liStartDate, liEndDate, lnI, lnBarNdx, liItmNdx *** Clear the time bars just in case the user selected a new start date *** Or Checks one of the boxes that says "View this event only" etc. *** The documentation says that the following should work, but in practice *** it does not - the call to ClearTimeBars() returns true, but they remain *** visible in the scheduler, so get out the sledge hammer *!* FOR lnI = 1 TO toScheduleObject.ListCount *!* toScheduleObject.ClearTimeBars(lnI) *!* ENDFOR toScheduleObject.ClearSchedule() Thisform.Initializelistbar(toScheduleObject) DO CASE CASE toScheduleObject = Thisform.pgfSchedule.pgEvents.oSchedule.object *** Get all the items in the list bar into a cursor in the same order that they are in the list bar IF Thisform.chkThisEvent.value SELECT DISTINCT FullName FROM SchedulerService_V WHERE SrvEvtID = Thisform.CurrentEventID INTO CURSOR qTmp NOFILTER ELSE SELECT DISTINCT FullName FROM SchedulerService_V ORDER BY FullName INTO CURSOR qTmp NOFILTER ENDIF SCAN liItmNdx = INT(RECNO('qTmp')) *** Process all the events for that person SELECT * FROM SchedulerService_V WHERE FullName == qTmp.Fullname INTO CURSOR Fred NOFILTER SCAN *** Need to add the case for "Non-Service" once I figure out what the heck that means DO CASE CASE Fred.SrvEvtID = Thisform.CurrentEventID lnBarColor = Thisform.shpThisEvent.BackColor CASE Fred.ServiceID = Thisform.CurrentServiceid lnBarColor = Thisform.ShpThisService.BackColor OTHERWISE lnBarColor = Thisform.shpOtherService.BackColor ENDCASE *** Make sure we actually have a scheduled event IF NOT EMPTY(Fred.EvtTimeBeg) AND NOT EMPTY(SchedulerService_V.EvtTimeEnd) AND ; NOT EMPTY(NVL(SchedulerService_V.EvtDateBeg, {})) AND NOT EMPTY(NVL(Fred.EvtDateEnd, {})) *** Make the the event falls within the selected date range liStartTime = (VAL(GETWORDNUM(Fred.EvtTimeBeg, 1, ':')) * 60) + VAL(GETWORDNUM(Fred.EvtTimeBeg, 2, ':')) liEndTime = (VAL(GETWORDNUM(Fred.EvtTimeEnd, 1, ':')) * 60) + VAL(GETWORDNUM(Fred.EvtTimeEnd, 2, ':')) liStartDate = Fred.EvtDateBeg - {^1900-01-01} liEndDate = Fred.EvtDateEnd - {^1900-01-01} *** Make sure that at least part of the event occurs within the specified date range IF liStartDate <= toScheduleObject.DateEnd AND liEndDate >= toScheduleObject.DateStart IF NOT Thisform.chkThisEvent.Value lnBarNdx = toScheduleObject.AddColorBar(liStartTime, liEndTime, liStartDate, liEndDate, lnBarColor, liItmNdx) toScheduleObject.BarCargo[liItmNdx, lnBarNdx] = PADL(Fred.SrvEvtID, 10, ' ') toScheduleObject.BarText[liItmNdx, lnBarNdx] = ALLTRIM(Fred.EvtTypeDesc) ELSE IF Fred.SrvEvtID = Thisform.CurrentEventID lnBarNdx = toScheduleObject.AddColorBar(liStartTime, liEndTime, liStartDate, liEndDate, lnBarColor, liItmNdx) toScheduleObject.BarCargo[liItmNdx, lnBarNdx] = PADL(Fred.SrvEvtID, 10, ' ') toScheduleObject.BarText[liItmNdx, lnBarNdx] = ALLTRIM(Fred.EvtTypeDesc) ENDIF ENDIF ENDIF ENDIF ENDSCAN SELECT qTmp ENDSCAN ENDCASE