Skip to main content
Version: 7.0

AFTER statement

The AFTER statement calls an action after calling another action.

Syntax

AFTER action(param1, ..., paramN) DO aspectAction;

Description

The AFTER statement defines an action (let's call it an aspect) that will be called after the specified action.

The aspect receives the same parameter values as the main action and runs after its body, including when the body ended with the RETURN operator. If the call was canceled by an aspect of the BEFORE statement or interrupted by an error, the aspect does not run. An exit from the aspect itself ends only the aspect. Several aspects of one action run in the order of their declaration.

Parameters

  • action

    The ID of the action after which the aspect will be called.

  • param1, ..., paramN

    List of action parameter names. Each name is defined by a simple ID. These parameters can be accessed when defining an aspect.

  • aspectAction

    A context-dependent action operator describing the aspect.

Examples

changePrice(Sku s, DATE d, NUMERIC[10,2] price)  { price(s, d) <- price; }

// A message will be shown after each call to changePrice
AFTER changePrice(Sku s, DATE d, NUMERIC[10,2] price) DO MESSAGE 'Price was changed';