Global Fields
Global fields may be confusing for the unprepared user since they are different from typical global variables in common programming languages. Actually, they are not variables at all.
As you can see in The Merge Algorithm global fields processing is done after the Document DOM has been created.
The algorithm is as follows:
- Merge loops through all empty global fields in a document.
- If found one it tries to find the nearest suitable value for this field.
- The nearest means it gets field parent and tries to find the same global field in a subtree. If successful it copies the value. If failed it gets one level up and retries.
The implication here is that if some global field is missing in an appropriate data location it gets filled with not the very first global value in a document tree but the nearest (see above) one.
Note, that if Merge can find the actual value for a field it doesn't do any special handling.
Let's examine one example, see image below.
EmptyChild pane is missing G1 data so it gets filled with G1 data from Child1 pane and not from Top pane.