Automation Engine Script Guide > Ordered by Function > Date and Time > CALE_LOOK_AHEAD

CALE_LOOK_AHEAD

Script Function: Returns the next date based on calendar conditions.

Syntax

CALE_LOOK_AHEAD([Date], JOBP\JSCH, Task Number)
CALE_LOOK_AHEAD
([Date], Condition, Calendar, Calendar Keyword, [[Calendar], [Calendar Keyword]]...)

Syntax

Description/Format

Date

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.

JOBP\JSCH

Name of a workflow or schedule
Format: script literal or script variable

Task Number

Task number in the workflow or the schedule
Format: script literal or script variable

Condition

Condition that must apply for the definition of date
Format: script literal or script variable

Allowed values: "ONE", "ALL", "NO"

"ONE" - One of the given calendar conditions must apply
"ALL" - All the given calendar conditions must apply
"NO" - None of the given calendar conditions must apply

If no calendar condition applies for a task, a SPACE is returned. In this case, CALE_LOOK_AHEAD_MAX is displayed in the Schedule monitor.

Calendar

Name of a calendar
Format: script literal or script variable

Calendar Keyword

Calendar keyword in this calendar
Format: script literal or script variable


Return codes

Date in the specified format
" " - No calendar condition applies

Comments

The script function may be used in two different ways.

On the one hand, it is possible to determine a respective object's next date of execution according to given calendar conditions. The object can be identified by its task number, which is displayed in the graphical picture of the workflow in the order in which the objects were added to the workflow. The schedule shows the objects, which are numbered according to their order in the list of the Schedule tab.

On the other hand, the script function supports the calculation of the next date on which one, all, or no calendar conditions apply. Up to five calendars may be specified, including calendar keywords. The maximum number of days that are to be considered when checking for the next valid date may be specified for each client by the administrator in the variable UC_CLIENT_SETTINGS with the key "CALE_LOOK_AHEAD_MAX".

It is possible to specify the date from which on calendar conditions should be checked. Optionally, you may specify a particular Date Format. The default Date Formats to be used are "YYMMDD" or "YYYYMMDD". A colon or semicolon may be used as a separator between Date Format and Date. If no date is specified, the particular current date is used for calculation.

This script function supplies the date either in the default format or in the format that has been defined in its first parameter.

Please note that the parameters Calendar and Calendar Keyword must always be used together (see example below).

Examples

The following example shows how to identify the next date on which the object with task number "3" will run in the workflow "MM.DAY".

:SET  &DATE# = CALE_LOOK_AHEAD('YYYYMMDD:20041010','MM.DAY','3')

The second example identifies the next date on which all assigned calendar conditions apply.

:SET  &DATE# = CALE_LOOK_AHEAD(,'ALL','FIRM.CALENDAR','WORKDAYS','FIRM.CALENDAR','READINESS01')

 

See also:

Script Elements - Date and Time

Date, Time and Period Formats

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function