Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the first schedDate where the working time is open.
Syntax
public SchedDate schedDate(
SchedDirection _schedDirection,
SchedDate _schedDateFrom,
Days _days,
CalendarDays _calendarDays,
CalendarId _calendarId,
[CalendarId _secondaryCalendarId,
SalesCheckForPickup _checkForPickup])
Run On
Called
Parameters
- _schedDirection
Type: SchedDirection Enumeration
Determines whether the date should be calculated backward or forward from the _schedDateFrom.
- _schedDateFrom
Type: SchedDate Extended Data Type
The from date upon which calculations are based.
- _days
Type: Days Extended Data Type
The lead time.
- _calendarDays
Type: CalendarDays Extended Data Type
Determines whether to consider open and closed days when you add lead time to the from date to acquire the first schedDate.
- _calendarId
Type: CalendarId Extended Data Type
The ID of primary calendar; optional.
- _secondaryCalendarId
Type: CalendarId Extended Data Type
The ID of secondary calendar; optional.
- _checkForPickup
Type: SalesCheckForPickup Enumeration
Determines whether to check if the schedDate is a pickup date, and in which calendar to check; optional. The default value is SalesCheckForPickup::Never.
Return Value
Type: SchedDate Extended Data Type
The first SchedDate where the working time is open.
Remarks
If both a primary calendar and a secondary calendar are provided, the schedDate will be the first date where there is an opening in both calendars. By using the argument _checkForPickup, it is possible also to require that the schedDate has to be open for pickup in either the primary calendar or the secondary calendar.
If either of the CalendarId objects that are passed as arguments are blank, the calendar will be treated as a calendar with all days open. This is because of the way the isDateOpen method functions.
To avoid infinite loops where two calendars never have a matching opening, an internal limit of 1,000 days is used. If no open day is found within this limit, the original from date (Arg2) is returned.
Examples
The job in the following code creates a WorkCalendarSched object and finds an open day.
static void job_testSchedDate(Args _args)
{
WorkCalendarSched workCalendarSched;
SchedDate schedDate;
SchedDate schedDateFrom;
Days leadTime;
CalendarDays calendarDays;
CalendarId primCalendar;
CalendarId secCalendar;
SchedDirection schedDirection;
workCalendarSched = new workCalendarSched();
//Inputs
schedDirection = SchedDirection::Forward;
leadTime = 4;
calendarDays = NoYes::Yes;
primCalendar = "STD";
secCalendar = "STD";
schedDateFrom = str2Date("16.06.2004", 123);
schedDate = workCalendarSched.schedDate(schedDirection,
schedDateFrom,
// from date
leadTime,
// LeadTime
calendarDays,
//Use calendardays
primCalendar,
secCalendar);
info(strfmt("Returned SchedDate : %1",schedDate));
}