DELETE_FORECAST
Use the DELETE_FORECAST script function to delete one or more Forecasts stored in the Automation Engine database. This script function deletes any type of Forecast:
Syntax
DELETE_FORECAST (FC_TITLE [, DAYS] [, FORCED])
Parameters
| Parameter | Description | Format | Default Value |
|---|---|---|---|
| FC_TITLE |
Specifies the title of the Forecast to delete. Note: You can use * as a wildcard character. Important: DELETE_FORECAST uses the forecast title to select forecasts to be deleted, and not the object name. |
Script literal | n.a. |
| DAYS |
(Optional) Defines the age (start time) of the Forecast. Note: To set the logical start date of the Forecast to today (todays_date) (23:59:59), enter 0 as the DAYS parameter. Tip: Take time zone rules into consideration when setting the DAYS parameter. For more information, see Logical Date and Real Date. |
Number, script literal, or script variable | No selection by logical start time (age) of the forecast. |
| FORCED |
(Optional) Deletes all Forecasts without a check. Note: Running Forecast calculations stop with undefined errors when you use this parameter.Without this parameter, the system checks whether the Forecast is running, and only deletes Forecasts that are not currently running. |
Script literal | n.a. |
Important Considerations
Key considerations include:
- The FC_TITLE and DAYS parameters are logically combined by an AND operator. The script function deletes Forecasts with the specified title that start on the specified day.
- The number of deleted Forecasts is displayed in message number 20824 in the report of the executable object that calls the script.
Return Codes
The DELETE_FORECAST function returns a numeric value based on the deletion status:
- 0
The Forecasts were deleted successfully. - A number greater than 0
Number of Forecasts that could not be deleted.
Examples
The following example deletes all Forecasts that are not currently running.
:SET &ret# = DELETE_FORECAST ("*",,)
The following example deletes all Forecasts with ENDED_OK status.
:SET &ret# = DELETE_FORECAST ("*")
The following example deletes all Forecasts that have the title MyFC, and stops any of those Forecasts if they are currently running.
:SET &ret# = DELETE_FORECAST ("MyFC",, FORCED)
The following example deletes all Forecasts whose title starts with FC_, and which are older than two days, and have ENDED_OK status.
:SET &ret# = DELETE_FORECAST ("FC_*", "2")
The following example deletes all Forecasts whose title starts with FC_, and which are older than two days.
:SET &ret# = DELETE_FORECAST ("FC_*", "2", "FORCED")
The following example deletes all Forecasts whose title starts with FC_, and whose logical start date is today (23:59:59).
:SET &ret# = DELETE_FORECAST ("FC_*", 0, "FORCED")
The following example deletes all Forecasts whose titles start with FC_, whose logical start date is today, and who have ENDED_OK status.
:SET &ret# = DELETE_FORECAST ("FC_*", 0)