SetAppVariable macro at system level
For executing the macro, the value for the Command field must be specified in this format:
SetAppVariable(Variable Name,Variable Value)
This table lists the parameters used to determine the Application Variable values to be set:
Parameter name | Description |
---|---|
Variable Name | The name of the Application Variable. |
Variable Value | The value to be assigned to the Application Variable. This value overrides the global, cycle or planning engine value defined for the Application Variable for the duration of the macro execution. |
On macro execution, the Application Variable values are set and used throughout the macro and all macros called from this macro through parameter variables. The value set in the SetAppVariable macro command can be used by subsequent macros (System, Cycle Period, Scenario, Planning Engine) within the same macro unless the parameter is specified to use an explicit value.
On completion of the macro execution, the application variable is reset to the original value using the global default/override or cycle/Planning Engine Cycle/Panning Engine value.
This table lists the examples of the SetAppVariable macro:
Test data | Processing details |
---|---|
Application Variable: Cycle_id = Demand Planning (PW) System Macro = Sys1 SetAppVariable("cycle_id","Demand Planning (M)") PauseCyclePeriod("%app_var_cycle_id%","","") ResumeCyclePeriod("%app_var_cycle_id%","","True","","") |
Executes System Macro Sys1 Sets the Application Variable Cycle_id to Demand Planning (M) Pauses the Cycle Demand Planning (M) Resumes the Cycle Demand Planning (M) |
Application Variable: Cycle_id = Demand Planning (PW) System Macro = Sys2 SetAppVariable("cycle_id","Demand Planning (M)") RunScenarioMacro("DPLS_Import Demand Plan", "%app_var_cycle_id%"","","Demand","DPlus-Baseline","") |
Executes System Macro Sys2 Sets the Application Variable Cycle_id to Demand Planning (M) Runs the scenario macro DPLS_Import Demand Plan passing the cycle id as Demand Planning (M), Module as Demand and Scenario as DPlus-Baseline. The passed values are used in all macro steps within this macro. |
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 lists the error message is displayed during the macro execution:
Parameter | Validation condition | Validation message |
---|---|---|
Variable Name | Check if the application variable exists. | Application Variable {0} cannot be found. |