Cicode Programming Reference > Cicode Function Categories > Scheduler Functions > SchdOpen

SchdOpen

The SchdOpen function initiates a new session for browsing the runtime schedules. It returns a handle for the browsing session which can be used for further browsing operations.

This function is a blocking function. It blocks the calling Cicode task until the operation is complete.

Syntax

LONG SchdOpen(STRING Equipment[, TIMESTAMP Start] [,LONG Duration] [,STRING Filter] [,STRING Fields] [, STRING Clusters] )

Equipment:

The name of the equipment to browse.

Start:

The start date of the schedules. If not specified, today at midnight will be taken as the start time. The types of this field is TIMESTAMP. Use StrToTimestamp or TimestampCreate Cicode functions to create a TIMESTAMP type.

Duration:

The duration of the browse in seconds. The default is 86400 seconds(24 hour)

Filter:

A filter expression specifying the records to return during the browse. An empty string indicates that every record will be returned.

Fields:

Specifies via a comma delimited string the columns to be returned during the browse. An empty string indicates that the server will return every available column. Supported fields are:

EQUIPMENT: The equipment name

STATE: The state to be set by the schedule

START: The start time of the schedule. The time is returned as a Timestamp value. Use StrToTimestamp() to get a TIMESTAMP data value.

END: The end time of the schedule. The time is returned as a Timestamp value. Use StrToTimestamp() to get a TIMESTAMP data value.

INHERITED: Indicates if the schedule entry is inherited from a schedule defined in a parent equipment higher in the hierarchy.

DESC: The description of the schedule.

Clusters:

An optional parameter that specifies via a comma delimited string the subset of the clusters to browse. An empty string indicates that the connected clusters will be browsed.

Return Value

Returns an integer handle to the browse session. Returns -1 when an error is detected.

For errors refer to the topic Cicode Errors in the Cicode Reference help

Related Functions

SchdConfigOpen,SchdConfigClose, SchdConfigFirst,SchdConfigNext,SchdConfigPrev, SchdConfigGetField, SchdConfigNumRecords, SchdClose, SchdFirst,SchdNext, SchdPrev,SchdGetField, SchdNumRecords, ScheduleItemAdd, ScheduleItemSetRepeat, ScheduleItemModify, ScheduleItemDelete

Example

	tsRuntimeBwseStartTime = TimestampCreate(2011, 11, 20, 0, 0, 0, 0);
	iRuntimeSession = SchdOpen("MyEquipment1", tsRuntimeBrowseStartTime, 86400,
	"state=ON", "", "Cluster1");
	IF iRuntimeSession = -1 THEN
		prompt("Could not open a schedule runtime browse session");
	END	
		

See Also

Scheduler Functions

Published June 2018