Purpose:
Returns the value of a variable and is specified with $ and (). For example: if VAR = 'abc', $(VAR) returns the value 'abc'. Variable references are evaluated during run time. When a variable is defined for an EXEC statement or block, Net.Data runs the specified action when it reads the variable reference.
You can dynamically generate a variable name by including variable references, strings, and function calls within a variable reference. If you reference a dynamcially-generated variable that does not follow the variable name rules, Net.Data resolves the reference to an empty string.
In variable references, leading and trailing whitespace is ignored and whitespace between function calls, strings, and variable references is not allowed. If a newline character is encountered between function calls, strings, and variable references, an error message is issued. A variable reference with any other white space returns an empty string.
Syntax:
>>---$--(--+-function_call------+---)-------------------------->< | (1) | +-string-------------+ '-variable_reference-'
Notes:
Example 1: Variable reference
If you have defined a variable homeURL:
%DEFINE homeURL="http://www.ibm.com/"
You can refer to the homepage as $(homeURL) and create a link:
<a href="$(homeURL)">Home page</a>
Example 2: Dynamically-generated variable reference
You can dynamically generate variable references to dynamically reference a field value in a row:
%WHILE (INDEX < NUM_COLS) { $(V$(INDEX)) @DTW_ADD(INDEX, "1", INDEX) %}
Example 3: A dynamic variable reference with nested variable references and a function call
%define my = "my" %define u = "lower" %define myLOWERvar = "hey" $($(my)@dtw_ruppercase(u)var)
The variable reference returns the value of hey.