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

  • DELETE_FORECAST
    Deletes one or more forecasts

  • FC_TITLE
    Title of the Forecast to delete
    Note: You can use * as a wildcard character.
    Format: string
    Important: DELETE_FORECAST uses the forecast title to select forecasts to be deleted, and not the object name.

  • DAYS
    (Optional) Age (start time) of the Forecast
    Format: number without quotation marks, script literal or script variable
    Default: No selection by logical start time (age) 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.

  • FORCED
    (Optional) Deletes all Forecasts without a check
    Notes:

    • 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.

Note: 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.

Return Codes

  • 0
    The Forecasts were deleted successfully
  • A number greater than 0
    Number of Forecasts that could not be deleted

The number of deleted Forecasts is displayed in message number 20824 in the report of the executable object that calls the script.

Examples

The following examples show how to achieve different results with DELETE_FORECAST:

  • : SET &ret# = DELETE_FORECAST ("*", ,)
    Deletes all Forecasts that are not currently running

  • : SET &ret# = DELETE_FORECAST ("*")
    Deletes all Forecasts with ENDED_OK status

  • : SET &ret# = DELETE_FORECAST ("MyFC", , FORCED)
    Deletes all Forecasts that have the title MyFC, and stops any of those Forecasts if they are currently running

  • : SET &ret# = DELETE_FORECAST ("FC_*", "2")
    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","FORCED")Deletes all Forecasts whose title start with FC_, and which are older than two days

  • : SET &ret# = DELETE_FORECAST ("FC_*",0, "FORCED"
    Deletes all Forecasts whose title starts with FC_, and whose logical start date is today (23:59:59)

  • : SET &ret# = DELETE_FORECAST ("FC_*",0)
    Deletes all Forecasts whose titles start with FC_ , whose logical start date is today, and who have ENDED_OK status

See also: