Automation Engine Script Guide > Ordered by Function > Read or Modify Objects > :SET_CALE

:SET_CALE

Script Statement: Inserts/deletes a date or time period in/from a calendar keyword.

Syntax

:SET_CALECalendar, Calendar Keyword, Date1, [Date2], [Action]

Syntax

Description/Format

Calendar

Name of the Calendar object in/from which a date/time period should be added or removed.
Format: AE name, script literal or script variable

Calendar Keyword

Name of the calendar keyword in/from which a date/time period should be added or removed.
Format: AE name, script literal or script variable

Date1
and

Date2

Indication of a date in the format "YYMMDD" or "YYYYMMDD".

Format: script literal or script variable

It is also possible to specify a different date format. Do so by entering the required date format, then enter a separator (: or ;) and afterwards the date. Indicating a date format is optional.

Action

Marker for adding or removing.
Format: AE name, script literal or script variable

Allowed values: "ON" (default value), "OFF"
"ON" - Add date/time period
"OFF" - Remove date/time period

Comments

You can use this script statement to add or remove a date/time period from a calendar.

If only one date should be added or removed, it is not necessary to specify Date2. For a time period, both Date1 and Date2 must be specified.

Optionally, you can specify a particular date format. The default date formats that should be used are "YYMMDD" or "YYYYMMDD".

If the assumed calendar keyword does not exist, the script statement creates a new calendar keyword of type "Statistic". By default, the current year minus NOW_MINUS and plus NOW_PLUS is used. Both specifications are keys that the administrator specified in the AE variable UC_CLIENT_SETTINGS. The validity range can be changed subsequently using the script function MODIFY_OBJECT.

When adding dates or times, this script statement ignores existing date/time period specifications. The same is true if you remove a date/time period that does not exist.

The script function VALID_CALE can be used to check whether a date is valid regarding a calendar and calendar keyword.

No calendar calculation is triggered while this script statement is being processed. Open and store the Calendar object manually to have the calendar recalculated.

Examples

The first example adds a date to the calendar "Readiness" and the calendar keyword "BU".

:SET_CALE "READINESS", "BU", "YY-MM-DD:00-12-24"

The second example removes the current day from this calendar.

:SET &TODAY# = SYS_DATE()
:
SET_CALE "READINESS", "BU", &TODAY#,, OFF

The third example determines the beginning and end of the current week. Afterwards, the time period is entered in the calendar.

:SET &TODAY# = SYS_DATE()
:
SET &BEGINNING# = FIRST_OF_PERIOD (&TODAY#, "WW")
:
SET &END# = LAST_OF_PERIOD (&TODAY#, "WW")
:
SET_CALE "READINESS", "BU", &BEGINNING#, &END#

 

See also:

Script element Description

VALID_CALE

Checks whether a date is included in the calendar keyword

Script Elements - Read or Modify Objects

Date, Time and Period Formats

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function