Click or drag to resize
ServiceTimeWindow data type
Print this page

The data type ServiceTimeWindow is a nested data type that represents a window of time when scheduled services can be completed on specified days of the week.


The ServiceTimeWindow data type has the following columns.

Column NameTypeDescription
EarliestArrivalTimeIntervalThe earliest arrival time
LatestArrivalTimeIntervalThe latest arrival time
DaysSet <EnumType<WorkDay>>A set of days that the time windows applies to.

The WorkDay enum type can have the following values:

  • Monday
  • Tuesday
  • Wednesday
  • ...
Specify one or more days, Monday through Sunday. Separate multiple values with a comma.
WeekdaysIncludes all weekdays, Monday through Friday
WeekendsIncludes Saturday and Sunday
AllIncludes every day of the week, Monday through Sunday

Note Note

On Retrieve operations, TDE always returns the days of the week that the enum represents. For example, if you specify "Weekends" in the input data, the template returns the value: "Saturday, Sunday".

The following template example shows how to use the ServiceTimeWindow data type when creating a schedule for creating job templates using the Schedule table.

In this example, the javascript section of the template specifies the service time window data for the schedule.

Create template
    TemplateVersion = 1.0
    TableID = Schedule-1.0
    TemplateName = ScheduleUpdateServiceWindows
    Intent = Update
    Format = Json
    IgnoreValue = ""

    Id(test) = Input.Id
    Name = Input.Name
    JobTypeId(test) = Input.JobTypeId
    MarkerId(test) = Input.MarkerId
    PreferredDriverId(test) = Input.PreferredDriverId
    FixedTimeOnSite = Input.FixedTimeOnSite
    StartDate = Input.StartDate
    AnchorDate = Input.AnchorDate
    Frequency = Input.Frequency
    PeriodCount = Input.PeriodCount
    PeriodType = Input.PeriodType
    Load = Input.Load
    Priority = Input.Priority
    Notes = Input.notes
    Code = Input.code
    EndDate = Input.EndDate
    AllowedVarianceBefore = Input.AllowedVarianceBefore
    AllowedVarianceAfter = Input.AllowedVarianceAfter
    TimeWindows = Input.TimeWindows

When you create or update ServiceTimeWindow values, you can provide ServiceTimeWindow time and day values by submitting a JSON input file like the following:

  "Id": "Nested1",
  "Name": "Update time windows",
  "JobTypeId": "Depot",
  "MarkerId": "Marker2",
  "PreferredDriverId": "Driver2",
  "FixedTimeOnSite": "01:00:01",
  "StartDate": "2018-9-1",
  "AnchorDate": "2018-9-1",
  "Frequency": 1,
  "PeriodCount": 1,
  "PeriodType": "Week",
  "Load": {
      "Apple": -100,
      "Banana": 60
  "TimeWindows": [{
      "Days": ["WeekDays"],
      "EarliestArrival": "22:00:00",
      "LatestArrival": "7:00:00"
      "Days": ["WeekDays"],
      "EarliestArrival": "9:00:00",
      "LatestArrival": "14:00:00"