Skip to main content

Instance variables are variables that can be created at the instance level and then used in script actions, custom transformation rules, and custom views. Variables can have fixed values or be set to system or instance properties and related information. This article describes how to add the different types of instance variables and then how to use them in your instance. 

Adding an Instance Variable

To add a new project variable, follow the steps below.

  1. On the Tools menu, click Instance Variables
  2. Click Add
  3. Provide a Name for the variable
  4. In the Type list, select the variable type from the following options:
    • Fixed: A fixed string.
    • System: One of the following system properties:
      • MachineName
      • UserName
      • UserDomainName
    • Source Scope: A property of the source of the current object.
    • Destination Scope: A property of the destination of the current object. The following variable returns the name of the data area for the given object to which the variable is applied.
    • Contextual Scope: A property of one specific element in the instance, such as a data area. Select a context in order to choose which data area the variable applies to. In the example below, the name of the contextual data area (i.e. Production) will be returned even if the variable is used in another data area, unlike the source and destination scope.
    • Dynamic: The value of the variable is generated by a custom script. When adding a dynamic variable, set the data area Context, and then select when the variable value is resolved from one of the following options in the Resolve Type list. 
      • Every Time: Resolve the value every time the value is used.
      • One Time: Resolve the value when the variable is used for the first time and reuse the resolved value for the following uses until the instance is closed.
      • Each Batch: Resolve the value once for each batch, e.g. an execution.
  5. Depending on the type of variable, configure how the value is set according to the following:
    • For a fixed variable, enter the value of the variable in the Value field.
    • For a dynamic variable, click Script Editor and enter the script that will generate the variable value.
    • For variables that are neither fixed nor dynamic, click the property for the value from the Value list.
  6. Click OK.

Using an Instance Variable

Instance variables can be used in script actions, custom views, and custom transformation rules. The available variables are listed in the right-hand side of the editor window. In order to use the variable, simply drag it over to the left-hand window. If the variable contains text values, enclose the variable in single quotes.

Updating Variable Values

The value of a given variable is determined when the object that is using the variable is deployed. Therefore, it is important to deploy an object when a variable has been changed so that the object using the variable is updated with the new value. 

Be the first to reply!

Reply