Adding a Schedule Using Visual Basic
The following is a Visual Basic code fragment that adds a new schedule called "Extended Work Hours," which includes all hours on all days:
Dim root As New FPCLib.FPC
' Declare a schedule collection.
Dim mySchedules As FPCSchedules
' Declare a schedule object.
Dim newSchedule As FPCSchedule
' Retrieve the schedule collection of the current array.
Set mySchedules = root.GetContainingArray.PolicyElements.Schedules
' Add the new Schedule.
Set newSchedule = mySchedules.Add("Extended Work Hours")
' Set the schedule days.
newSchedule.Set fpcALL_WEEK, fpcALL_DAY
' Save the changes.
mySchedules.Save
Note that the changed schedule is not saved to persistent storage until the last line of code, where the Save method is called.
Related topics
Build date: 7/12/2010