SetAppVariable macro command

The SetAppVariable macro is used to set the value for the application variables. This macro is executed at a system level.
These mandatory parameters are used to determine the Application Variable values to be set:
Application Variable Name
The name of the Application Variable.
Value
The value to be assigned to the Application Variable. This value overrides global value of the Application Variable.

For executing the macro, the value for the Command field must be specified in this format: SetAppVariable([Application Variable],[Value])

On macro execution, the Application Variable values are set and can be used in other system macros through parameter variables.

These scopes are defined for the Application Variable:

  • Global: As defined in the Application Variable page.
  • Macro: As set in the SetAppVariable command. This value can be overridden by the global value.
  • Cycle: As defined in the Cycle/Application Variable, which is a version of the variables associated with the cycle. This value can be overridden by the macro and global values.
Table 1. Example
Requirement Parameter
Set application variable cycle_id to a value of Supply Plus (W) SetAppVariable(“cycle_id”,supply plus (w)”)
This table describes the processing examples.
Test Data Processing Details

Application Variable: cycle_id=Demand Planning(PW)

System macros: Pause and Resume

SetAppVariable("cycle_id","Demand Planning (M)") PauseCyclePeriod("%app_var_cycle_id%","","") ResumeCyclePeriod("%app_var_cycle_id%","","True","","")

Cycle completion: Pause and Resume

CompleteCyclePeriod("%app_var_cycle_id%","","","")

Execute system macro Cycle completion

Use the Pause / Resume option to pause or resume the cycle period for the Demand Planning (M) cycle.

Complete cycle period completes the cycle period for Demand Planning (PW) cycle.

Application Variable: scv_dpls_profile=DPLS_BASE

Cycle Demand (M) Application Variable

scv_dpls_profile=DPLS_BASEPlus

Scenario Values Interface Service: Query includes

profile_name = '%app_var_[scv_dpls_profile]%;

Execute macro to run interface service within the Demand (M) cycle period.

The query uses DPLS_BASEPlus for the profile name in the interface service.

Application Variable: Site_id=100

'Import My SCV Data' Interface Service: Query includes 'and profile_name = '%app_var_[site_id]%;

System Macro:

RunSCVInterfaceService("Import My SCV Data","Import","","")

RunSCVInterfaceService("Import My SCVData","Import","","")

SetAppVariable("Site_id","300")

RunSCVInterfaceService("Import My SCV Data","Import","","")

Execute system macro.

First interface service uses 100 for the profile name, second interface service uses 200 for the profile name. And the last interface service uses 300 for the profile name.

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

Parameter Validation Validation Message
Application Variable Name Check the application variable exists Application Variable {0} cannot be found