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

SchdConfigOpen

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

Syntax

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

start:

The start date of the schedules in UTC time to return during the browse.If not specified, today at midnight will be taken as 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.

All string fields can be filtered based on regular expressions. Using operators other than = and <> will cause strings to not match the filter criteria. The following regular expressions are supported *expr, expr*, and *expr*.

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:

ID:

The unique ID of the schedule within the schedule engine. ID value is the same for all recurring schedules.

EQUIPMENT:

The equipment name

STATE:

The state of the schedule

START:

The start time of the schedule.

OCCURRENCESTART:

The start of this occurrence. For non-recurring entries will be the same as START.

END:

The end time of the schedule.

OCCURRENCEEND:

The end of this occurrence. For non-recurring entries will be the same as END.

DESC:

The description of the schedule.

MODIFIEDTIME:

The time when the entry was modified last time.

Note: Time values (START, OCCURRENCESTART, END, OCCURRENCEEND, MODIFIEDTIME) are TIMESTAMP type. Use TimestampToStr() cicode function to convert it to string.

The following fields are used when a schedule is recurrent. The value of FREQ filed -1 means the schedule is not recurrent:

FREQ:

The type of the recurrence: 4 - daily, 5 - weekly, 6- monthly, 7 - yearly, 8 - special days. -1 means this schedule is non-recurring.

INTERVAL:

The interval of the recurrence. 1 - every 1 day/week/month etc., 2 - every second day/week/month etc. and so on.

WEEKDAY:

The first day of the week

WEEKDAYMASK:

The day of week mask. Defines day of week where recurrence happens.

None = 0,

Sunday = 1,

Monday = 2,

Tuesday = 4,

Wednesday = 8,

Thursday = 16,

Friday = 32,

Saturday = 64,

Everyday = 127,

Weekdays = 62,

Weekenddays = 65

Combination of days can be achieved by addition. For example, Tuesdays and Wednesdays would be 12 (4 + 8).

MAXREC:

The maximum number recurrences (-1 means MAXREC is not specified. If MAXREC is -1 then the recurrence stops on the date specified by RECUNTIL field. If RECUNTIL is not specified the recurrence occurs forever).

RECUNTIL:

The time until recurrence occurs. -1 means never stops (or finishes after MAXREC occurrences if is specified).

DAYORD: Day ordinal. Applicable for monthly and yearly recurrence patterns. Using the values 1 to 4 you can set the schedule to run on the first, second, third, or fourth occurrence of the DAY in each month (monthly recurrences), or the specified MONTH (yearly recurrences). Use the value -1 for the last week of the month

DAY:

The day of month

MONTH:

The month of the year

SPECIALINC:

Defined whether the special day is included in the pattern. 0 - none, 1 - all, 2 - selected.

GROUPIDS

A list of group’s ID included in the recurring pattern (used only when SPECIALINC is defined as 2 ("selected")).

sClusters:

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.

Related Functions

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

Example

		
tsConfigtimeBrowseStartTime = TimestampCreate(2011, 11, 20, 0, 0, 0, 0);
iConfigtimeSession = SchdConfigOpen(tsConfigtimeBrowseStartTime, 86400, "Id=1",
"", "Cluster1");
IF iConfigtimeSession = -1 THEN
   prompt("Could not open a schedule configtime browse session");
END				

See Also

Scheduler Functions

Published June 2018