![]() ![]() |
Reference Type: Supported, Category: Date Functions, ICR#: 10103
The $$SCH^XLFDT extrinsic function returns the next run-time based on Schedule code.
$$SCH^XLFDT(schedule_string,base_date[,force_future_flag])
schedule_string: |
(required) Interval to add to base_date, as follows:
|
base_date: |
(required) VA FileMan date to which the interval is added. |
force_future_flag: |
(optional) If passed with a value of:
|
returns: |
Returns the next run-time. |
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:
>S X=$$SCH^XLFDT("1M(15@2PM,L@6PM)",2931003) >W X 2931015.14 |
>S X=$$SCH^XLFDT("1M(15@2PM,L@6PM)",X) >W X 2931031.18 |
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:
>S X=$$SCH^XLFDT("1M(15@11PM,L@8PM)",2931028) >W X 2931031.2 |
>S X=$$SCH^XLFDT("1M(15@11PM,L@8PM)",X) >W X 2931115.23 |
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:
>S X=$$SCH^XLFDT("3M(L@6PM)",2930927) >W X 2930930.18 |
>S X=$$SCH^XLFDT("3M(L@6PM)",X) >W X 2931231.18 |
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.