| ServiceTimeWindow data type |
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 Name | Type | Description |
|---|---|---|
| EarliestArrival | TimeInterval | The earliest arrival time |
| LatestArrival | TimeInterval | The latest arrival time |
| Days | Set <EnumType<WorkDay>> | A set of days that the time windows applies to. |
The WorkDay enum type can have the following values:
| Value | Description |
|---|---|
| Specify one or more days, Monday through Sunday. Separate multiple values with a comma. |
| Weekdays | Includes all weekdays, Monday through Friday |
| Weekends | Includes Saturday and Sunday |
| All | Includes every day of the week, Monday through Sunday |
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.
[Template]
TemplateVersion = 1.0
TableID = Schedule-1.0
TemplateName = ScheduleUpdateServiceWindows
Intent = Update
Format = Json
IgnoreValue = ""
[Output]
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.TimeWindowsWhen 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"
}]
}]