Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Scripting_function



Panel
titleDescription

Returns a specific schedule.


Panel
titleClient Permission Restrictions

This scripting function has no Client Permission restrictions.


Panel
titleSyntax

system.user.getSchedule(scheduleNames)

  • Parameters

String scheduleName - The name of the schedule to return. Case-sensitive

  • Returns

AbstractScheduleModel - The schedule, which can be a BasicSchedule, CompositeSchedule, or another type registered by a module, or None if not found.

  • Scope

All


Panel
titleDescription

Once the schedule is returned, functions of the resulting object are used to get various information from that schedule. See examples below.

MethodReturn TypeDescription
equals(schedule object obj) booleanReturns the name of the schedule.
getDescription() java.lang.StringReturns the description of the schedule.
getName() java.lang.StringReturns the name of the schedule.
getScheduleForDay(java.util.Calendar cal)abstract TimelineReturns a Timeline object with the day's schedule, or null if no schedule for the day.
getType() abstract java.lang.StringReturns the type of the schedule.
hashCode() int
isObserveHolidays() abstract boolean

Returns whether holidays are being observed by the schedule.

setDescription(java.lang.String description) void

Sets the description of the schedule

setName(java.lang.String name) voidSets the name of the schedule
setObserveHolidays(boolean observeHolidays) abstract voidSets whether the schedule will observe holidays.




Panel
titleCode Examples


Code Block
languagepy
titleCode Snippet
# This example will get a schedule and print info about it:
 
# This function handles recursive printing of the different schedule types. Modules can register more types than listed here.
def printScheduleInfo(aSchedule):
	if aSchedule.getType() == "basic schedule": 
		print "Basic schedule type: ",aSchedule.getName(), aSchedule.getDescription(), aSchedule.isAllDays(), aSchedule.isObserveHolidays()
	elif aSchedule.getType() == "composite schedule":
		compositePieces = aSchedule.getModels()
		print "Composite schedule type:",aSchedule.getName(), aSchedule.getDescription(), " which is made up of..."
		for piece in compositePieces:
			printScheduleInfo(piece)
	else:
		print "Other schedule type: ", aSchedule.getName(), aSchedule.getDescription(), aSchedule.getType(), aSchedule.isObserveHolidays()
 
# The main function
scheduleName = "MySchedule"
schedule = system.user.getSchedule(scheduleName)
if schedule == None:
	print "Schedule", scheduleName, "was not found"
else:
	printScheduleInfo(schedule)


Code Block
languagetext
titleOutput
Basic schedule type:  MySchedule A description False True