Creating macros
To create a macro:
- Select Configuration > Cycles > Macros to display a list of macros.
- Click New.
-
Specify this information:
- Name
- The unique identifier of the macro in SCP.Note: You cannot modify the name after the macro is created.
- Display Name
- The name to be displayed in the application.
- Users
-
The name of the users who can access the macro.
- Roles
-
The defined role of the user(s) who can access the macro.Note: At least one user or role must be assigned to a macro. For a new macro, the current user id ID is defaulted.
- System
- Indicates, if the macro is system defined or user
defined.Note: If this option is set to On, the macro is system defined and cannot be edited by the user.
- Enabled
- Indicates, if the macro is enabled and can be executed.Note: By default, this value is set to On.
- Tags
- The tag linked to a macro. Select from a list of pre-defined tags displayed in the Tags window. You can link one or more tags to a macro. This option is used to group common elements, which can be linked to entities such as measures or worksheets.
- Type
- The type of the macro. Possible values:
-
Cycle Period: A macro that can be used at cycle period level,
which interprets the data for the current cycle and cycle period.
Selecting type=Cycle Period must clear and remove the Module field as it is not
applicable.Note: You can execute this macro using the Execute Macro option on the worksheet toolbar or the Scenario Details option in the module. This allows you to call the macro commands (
AddCyclePeriodNote
,CreateScenario
,CopyScenario
, andRunScenarioMacro
) for the cycle period. - Scenario: A macro that can be used within the context of the current scenario.
- Planning Engine: A macro that can be used within the context of a Planning Engine. Selecting type=Planning Engine must clear and remove the Module field as it is not applicable.
-
System: A macro that can be executed without defining a cycle period,
scenario or Planning Engine context. However, if the cycle period,
scenario or Planning Engine is required, the same is specified in the
commands for the steps of the macro. For example, Complete Cycle
Period (W). Selecting type=System must clear and remove the Module field as it is not
applicable.Note:
- The steps for macro are executed based on the availability of the associated cycle period, scenario, or background processes (such as the setup checker), and the time out parameter defined in the related commands.
- Each macro step is linked to a unique transaction, so the completed steps are always committed.
-
Cycle Period: A macro that can be used at cycle period level,
which interprets the data for the current cycle and cycle period.
Selecting type=Cycle Period must clear and remove the Module field as it is not
applicable.
- Module
- The module for which the macro is defined.
Note: This option is enabled only for macros of the type Scenario.
- Click '+' in the Steps section to create a new command for the macro. The Steps section contains a list of commands defined for the macro.
-
Specify the information in the Step
window:
- Command Type
- The type of the command. The available command list is based on the macro Type specified.
- Command Parameter
- The value of this field is based on the specified Command Type and is a visual representation of the required parameters.
- Command
- The command syntax executed by this step. Each
command consists of a function and multiple parameters which indicates the
correct syntax for the specified Command Type.Note: The optional parameters are indicated by [] and all other parameters must be populated accordingly in the Command field.
- Description
- An optional description for the step.
- Condition
- A condition that controls the execution of macro steps. The
condition can contain application variables that are evaluated based on the
level (System or Cycle) at which the macro is executed. For example,
isTag('DPLS-Demand','DPLS-DemandLight').Note:
- If this value is not specified, the macro step is executed.
- The condition must support the basic logic operators such as ‘!=, ==, <, >, <=, >=, AND, OR, ()'’ and the isTag function.
- isTag function validates if all the listed tags are included in the cycle or planning engine, for the macros at cycle period, scenario, and planning engine. If all the listed tags are not defined at cycle period or planning engine, or the macro is defined at system level, the evaluation result is set to False.
- Override Condition
- An override condition is used instead of (or in conjunction with)
the value specified for Condition. The override condition can include
application variables which are evaluated based on the level
(System/Cycle/Planning Engine) at which the macro is executed. For example,
%default% AND isTag('DPLS-Demand','DPLS-DemandLight').Note:
- If this value is not specified, the override conditions are not applied.
- The condition must support the basic logic operators such as ‘!=, ==, <, >, <=, >=, AND, OR, ()'’, isTag function and the %default% and %empty% parameters.
- %empty% can be used to override the default condition with no value.
- %default% can be used to append or pre-append the default condition to the override condition in conjunction with the AND, OR operators.
- Click Add. A new command is added to the list in the Steps section.
-
Click Move Up and
Move Down arrow to change the order of
the commands.
Note: For a system defined macro, the step list cannot be modified.
- Click Save. A new macro is created.