Monday 27 July 2009

Variables in Datamanager - Manual Unclear

NB Variables are case insensitive

PARISHILTON
parishilton
ParisHilton

are all equivalent.

1. Explicit Declaration of variables can be done at 6 levels.
========== Highest Level ================
(a) As an environment variable
(b) In the command line to invoke DM build or Job Stream
(c) In the Jobstream variables tab
(d) In the Build variables tab
(e) In the DataSource variables tab
(f) In the declaration of a function
========== Lowest Level ================
The lifetime of the variable is the lifetime of the item within which it is defined.

The variable is visible and modifiable to all lower levels unless it is masked when a variable of the same name is declared at a lower level.
NB do NOT use a $ when you declare a variable. It does not complain if you do!

2. In addition to the above levels Variables can be used

(i) In derivations in the Datasource
(ii) In derivations in the Datastream
(iii) In derivations in the Transformation Model

NB Make sure you use a $ to distinguish a variable from a derivation or an argument.

Variables can be assigned to derivations.

$x = y ;

In the event that multiple assignments take place the value returned to the jobstream will be the LAST calculated value.
Derivations can be assigned to variables

eg

$x

or

return $x

3. Implicit declaration is done

When a function is run at the function level during testing then any variables in the function are implicitly defined.
When the Build is run at the build level then any variables at the build are implicitly defined.

If you rely on an implicit definition and run at a higher level then you get this message.
DM-PRS-1001 Error parsing build specification, failed to replace special items;variable 'DI' could not be found
Implicit declaration will not work where you assign a variable to an expression that contains the same variable eg $x := $ x + 1 ;

4. Variable tracing

Does not record every assignment, but seems to be triggered on the creation of a variable. Certainly it shows variables as being incorrectly assigned to a ''.

No comments:

Post a Comment