Kernel 8.0 APIs Banner
Office of Information and Technology (OIT) Banner
[skip navigation]

$$SCH^XLFDT(): Next Scheduled Runtime

Reference Type: Supported, Category: Date Functions, ICR#: 10103

Description

The $$SCH^XLFDT extrinsic function returns the next run-time based on Schedule code.

Format

  $$SCH^XLFDT(schedule_string,base_date[,force_future_flag])

Input Parameters

schedule_string:

(required) Interval to add to base_date, as follows:

  • nS—Add n seconds to base_date.

  • nH—Add n hours to base_date.

  • nD—Add n days to base_date.

  • nM—Add n months to base_date.

  • $H;$H;$H—List of $H dates.

  • nM(list)—Complex month increment. For example: 1M(15,L), which means schedule it to run every month (1M) on the 15 and last day of the month (15,L).

    • dd[@time]—Day of month (e.g., 12).

    • nDay[@time]—day of week in month (e.g., 1M, first Monday); (see "Day Code" list that follows).

    • Day.

    • L—Last day of month.

    • LDay—Last specific day in month (e.g., LM [last Monday],LT [last Tuesday],LW [last Wednesday]...).

  • Day[@time]—Day of week (see "Day Code" list that follows).
    • Day.

    • D—Every weekday.

    • E—Every weekend day (Saturday, Sunday).

    Day Code (used in schedule codes above):

    • M—Monday

    • T—Tuesday

    • W—Wednesday

    • R—Thursday

    • F—Friday

    • S—Saturday

    • U—Sunday
base_date:

(required) VA FileMan date to which the interval is added.

force_future_flag:

(optional) If passed with a value of:

  • 1—FForces returned date to be in future, by repeatedly adding interval to base_date until a future date is produced.

  • Otherwise—Interval is added once.

Output

returns:

Returns the next run-time.

Examples

Example 1

To schedule something to run every month on the 15th of the month at 2:00 p.m. and on the last day of every month at 6:00 p.m., you would enter the following:

Middle of the Month:
>S X=$$SCH^XLFDT("1M(15@2PM,L@6PM)",2931003)

>W X
2931015.14
End of the Month:
>S X=$$SCH^XLFDT("1M(15@2PM,L@6PM)",X)

>W X
2931031.18

Example 2

To schedule something to run every month on the 15th of the month at 11:00 p.m. and on the last day of every month at 8:00 p.m., you would enter the following:

Middle of the Month:
>S X=$$SCH^XLFDT("1M(15@11PM,L@8PM)",2931028)

>W X
2931031.2
End of the Month:
>S X=$$SCH^XLFDT("1M(15@11PM,L@8PM)",X)

>W X
2931115.23

Example 3

To schedule something to run every 3 months on the last day of the month at 6:00 p.m., you would enter the following:

Middle of the Month:
>S X=$$SCH^XLFDT("3M(L@6PM)",2930927)

>W X
2930930.18
End of the Month:
>S X=$$SCH^XLFDT("3M(L@6PM)",X)

>W X
2931231.18

Example 4

The API can return a date that is closer to the date the API is run if the user does not use the force_future_flag parameter and the base_date parameter is set to a date in the past. In this example, the base_date parameter is set to a date in the past, 11/17/2014 at 8:00, and the interval is set to find the date 2 months out on the second Monday of the month. The date that is returned is the date that the API was run, 1/12/15, which happens to be the second Monday of the month and two months out from the base_date.

>S X=$$SCH^XLFDT("2M(2M@0800)",3141117.0800)

>W X
3150112.08

If using the force_future_flag parameter to the API, using the same interval as above, the API forces the return date to be a date in the future from the date the API is run.

>S X=$$SCH^XLFDT("2M(2M@0800)",3141117.0800,1)

>W X
3150309.08

NOTE: The base_date must be passed correctly. The base_date parameter is compared to the schedule_string parameter in the interval to return the correct output.