3.6 Variable Selector

The variable selector provides a list of variables that you can select and insert into conditions, actions, and tokens.

3.6.1 Dynamic Variable Expansion

The variable selector allows for the use of dynamic variable expansion in conditions, actions, and tokens. It is used when the writer of the DirXML script doesn’t know what value to enter during the design phase, and wants the value to be populated dynamically when the code is run (for local variables) or when the driver starts (for global variables). Dynamic variables are not used when the policy needs to refer directly to the variable itself. Instead, they are used when the policy needs to refer to the value of the variable.

Many actions support dynamic variable expansion in their attributes or content. Where supported, an embedded reference of the form $variable-name$ is replaced with the value of the local variable with the given name. An embedded reference of the form ~variable-name~ is replaced with the value of the global variable name. $variable-name$ and ~variable-name~ must be legal variable names. For information on what constitutes a legal XML name, see W3C Extensible Markup Language (XML).

If the given variable does not exist, the reference is replaced with the empty string. Where it is desirable to use a single $ and not have it interpreted as a variable reference, use an additional $ as an escape character (for example, You owe me $$100.00).

NOTE:If the global variable doesn’t exist on the driver or driver set, the driver does not start.

3.6.2 Accessing the Variable Selector From the Conditions Tab

  1. In the Policy Builder, double-click the Conditions tab.

    For instructions on accessing the Policy Builder, see Section 3.1, Accessing the Policy Builder.

  2. Select one of the following conditions:

  3. Click the Launch variable browser iconLaunch variable browser next to the field where you want to insert a dynamic variable.

  4. Select the variable, then click OK.

Or, for conditions that don’t bring up the Launch variable browser icon:

  1. Select one of the following operators:

    • Equal

    • Greater than

    • Less than

    • Not equal

    • Not greater than

    • Not less than

  2. Click the Launch variable browser icon next to the field where you want to insert the dynamic variable.

  3. Select the variable, then click OK.

3.6.3 Accessing the Variable Selector From the Actions Tab

3.6.4 Accessing the Variable Selector From the Argument Builder

  1. In the Argument Builder, select one of the following noun tokens from the Nouns section:

    Or, select one of the following verb tokens from the Verbs section:

  2. Click the Launch variable browser iconLaunch variable browser next to the field where you want to insert the dynamic variable.

  3. Select the variable, then click OK.

3.6.5 XPath Expressions

Instead of using the DirXMLScript engine to perform the variable expansion, as is the case with most variable expansion, XPath uses built in XPath functionality and the XSLT processor to do the variable expansion.

For conditions, actions, and tokens that contain XPath expressions, a single $ sign at the beginning of the policy denotes a dynamic variable, which is displayed in the Value field. This is also true for the XPath token in the Argument Builder, and for all actions that contain XPath. This is because in order to maintain valid XPath, only one $ sign can be used.

The following procedure gives an example of using the variable selector with XPath expressions:

  1. In the Policy Builder, click the Actions tab.

  2. In the Do field, select the clone by XPath expressions option.

  3. After the Specify source XPath expression field, click the Launch variable browser iconLaunch variable browser.

  4. Select an item and click OK.

    Only one $ sign is displayed before the policy.