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

ScheduleItemAdd

The ScheduleItemAdd function adds a new schedule to the scheduler engine. It returns the Id of the schedule which can be used for modifying, setting recurrence and deleting this schedule.

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

Syntax

LONG ScheduleItemAdd(STRING Cluster, STRING Equipment, STRING State, TIMESTAMP Start, TIMESTAMP End, STRING Desc)

Cluster:

The name of the cluster

Equipment:

The name of the equipment to browse.

State:

The state of the schedule

Start:

The start time of the schedule. The type of this parameter is TIMESTAMP. Use TimestampCreate or StrToTimestamp to get a TIMESTAMP value.

End:

The end time of the schedule. The type of this parameter is TIMESTAMP. Use TimestampCreate or StrToTimestamp to get a TIMESTAMP value.

Desc

The description of the schedule.

Return Value

The id of the schedule which can be used for modifying, setting recurrence and deleting this schedule. This function returns -1 if unsuccessful. Trap the error to get the error returned by this function.

Related Functions

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

Example

		
	//The following example creates a schedule item using state MyState1 for
	MyEquipment1, that starts from 3am and ends at 4am on 20th of Nov 2011.
 
	TIMESTAMP tsStartTime;
	TIMESTAMP tsEndTime;
	INT iScheduleID;
	tsStartTime = TimestampCreate(2011, 11, 20, 3, 0, 0, 0);
	tsEndTime = TimestampCreate(2011, 11, 20, 4, 0, 0, 0);
	iScheduleID = ScheduleItemAdd("Cluster1",
	"MyEquipment1","MyState1",tsStartTime,tsEndTime,"MyScheduleItem1");	
		

See Also

Scheduler Functions

Published June 2018