CallForecastEngine macro

The CallForecastEngine macro calls the specified forecast engine to generate forecast for a selected item and location.

This supports the generation of forecasts for the selected item/location at the base-level or a grouped forecast for the selection with output prorated to the appropriate level to store scenario values. This macro is executed at scenario level.

This table describes the parameters used in the macro.
Parameter Name Description
Engine Name The name of the forecast engine to call. The engine determines the type of engine and the default settings.
Note: This parameter must be defined for the current cycle and module.
Algorithm The algorithm used in the forecast generation process. Possible values:
  • BATS
  • BEST
  • CROSTONS
  • EVENTSONLY
  • EXPONENTIALMOVINGAVERAGE
  • HOLTWINTERS
  • LEASTSQUARES
  • MOVINGAVERAGE
  • MULTIPLEREGRESSION
Note: 
  • If not defined, the default algorithm from the specified engine is used.
  • If default algorithm is not defined in the engine setting, BEST is used.
Item hierarchy level The level (from the item hierarchy) at which the forecast engine generates the forecasts.
Note: If not specified, the default value from the Forecast Engine Settings is used.
Item hierarchy selection The base elements at the Item hierarchy level to determine the item selection. The value is passed as a node. For example, ‘Brand A’.
Note: 
  • If not defined, all the valid items are processed.
  • You must adhere to the data security rules of the user when selecting the items.
Location hierarchy level The level (from the location hierarchy) at which the forecast engine generates the forecasts.
Note:  If not specified, the default value from the Forecast Engine Settings is used.
Location hierarchy selection The base elements at the Location hierarchy level to determine the location selection. The value is passed as a node. For example, ‘EMEA’.
Note: 
  • If not defined, all the valid items are processed.
  • You must adhere to the data security rules of the user when selecting the items.
Optimize Indicates, optimization process of the forecast engine. Possible values:
  • On: The engine must optimize the parameters based on the passed data set before calculating the forecast.
  • Off: The passed parameters and default values are used for the forecast calculation.
Note: 
  • If not specified, the default value from the Forecast Engine Settings is used.
  • This field is only applicable for the BEST or Holt-Winter algorithm.
Filter The filter criteria that is applicable for the selected item and location at the specified Item and Location hierarchy level.
Note: 
  • The item@location that pass the criteria, for the specified Period label, are used in the forecast generation.
  • If not specified, filter criteria are not applied.
For executing the macro, the value of the Command field must be specified in this format:Engine Name, [Algorithm], [Spreading Measure Code], [Item Hierarchy level], [Item Hierarchy selection], [Location Hierarchy level], [Location Hierarchy selection], [SMP Measure], [Optimize], [Filter]
Note: The optional Parameters are specified in [ ].

On macro execution, the status is changed to ‘Running’ to indicate that the macro is being processed. The status is changed to ‘Completed’ when the process is completed.

When BEST algorithm is used, the macro call the forecast engine with fitModelPickingAlgorithm() which allows the engine to fit using the algorithm with the lowest decision criteria. The selected algorithm is returned as output.

When the algorithms other than BEST, fitModelGivenAlgorithm() is used for calling the forecast engine.

Table 1. Example
Requirement Parameters
Call ‘Test Engine’ passing all the default engine settings and calculating for all items and locations. Results are spread using the default spreading measure. CallForecastEngine("Test Engine")
Call ‘BATS engine’, using the default engine algorithm, for valid SKU-level items under the Brand A node in the item hierarchy, for Customer-level locations under the US node in the location hierarchy. No spreading is required as the specified levels are equal to the level for storing scenario values. CallForecastEngine("BATS engine","","","SKU","Brand A","Customer","US")
Call ‘BATS engine’, using the default engine algorithm, for the aggregated node Brand A in the item hierarchy, for the aggregated Region node US in the location hierarchy. Uses the Spread measure defined in Engine (TUPLE_EXISTS) to spread results to the base item and location Cycle.level to store scenario values. CallForecastEngine("BATS Engine","","","Brand","Brand A","Region","US")
Call ‘New Engine’, passing the LEASTSQUARES algorithm, spreading results to base items and locations via TUPLE_EXISTS measure (as defined in the Forecast Engine), calculating all Product Groups and all Regions at monthly calendar level (as specified by the engine's period level). CallForecastEngine("New Engine","LeastSquares","","Product Groups","","Regions","","","")
Call ‘Best Fit’, passing the Best (Picking) algorithm, spreading results via Spreading Measure defined in Engine, calculating all Product Groups and all Regions. Parameter optimization is done prior to selecting the algorithm and generating the forecast. CallForecastEngine("Best Fit","BEST","","Product Groups","","Regions","","","TRUE")

Validations are performed when you execute the macro. If any of the validation fails, the macro is aborted, and the related error message is displayed.

This table describes the Scenario Macro commands as compared to the Cycle Period/Scenario status and validation messages.
Cycle Period status Scenario status Can Execute? Validation message
Pending N/A No Cannot run macro {0} because Cycle Period has status ‘Pending’
Running WIP Yes N/A
Running Review, Rejected, Stopped, Approved, Published No Cannot run macro {0} because Scenario has status {1}
Paused Any No Cannot run macro {0} because Cycle Period is not ‘running’
Completed Any No Cannot run macro {0} because Cycle Period has status ‘Completed’
Aborted Stopped No Cannot run macro {0} because Cycle Period has status ‘Aborted’
Archived Any No Cannot run macro {0} because Cycle Period has status ‘Archived'
This table describes the error message displayed during the macro execution.
Validation Condition Error Message
Check the Forecast engine name exists. forecast engine {0} cannot be found.
Where specified, or using defaults defined in the forecast engine settings, ensure the measures are valid for this cycle.Module and Enabled (parameter mappings and spreading measure. measure "{0}" cannot be found.
Where specified, or using defaults defined in the forecast engine settings, ensure the item level item hierarchy level "{0}" cannot be found.
Where specified, or using defaults defined in the forecast engine settings, ensure the location level is valid. location hierarchy level "{0}" cannot be found.
Where specified, or using defaults defined in the forecast engine settings, ensure the period level is valid. Note the specified calendar level must be Months for an engine of type BATS.

period level {0} cannot be found.

period level {0} must be Months or CMonths for engine type=BATS

Where specified, ensure the item and location nodes are valid. item {0} cannot be found.

location {0} cannot be found.

Where specified, ensure the algorithm is valid the specified algorithm {0} is not supported. Valid entries are: (Best, BATS, Crostons, EventsOnly, ExponentialMovingAverage, HoltWinters, LeastSquares, MovingAverage and MultipleRegression).
Where specified, or using defaults defined in the forecast engine settings, ensure the measures are not defined as Market Intelligence type measures (parameter mappings). measure "{0}" cannot be of type Market Intelligence.
Where specified, or using defaults defined in the forecast engine settings, ensure the measures are not defined as Transactional Data type measures (parameter mappings). measure "{0}" cannot be of type Transactional Data
Where specified, or using defaults defined in the forecast engine settings, ensure the measures are not defined as Order type measures (parameter mappings). measure "{0}" cannot be of type Orders.
User must have permission to run a Forecast Engine Forecast Generation on module "{0}" is not permitted for user "{1}"