RootValue

(Engine-Level Function)

Description: Retrieves the root value from a dictionary. This function will always attempt to return a value that is not itself a dictionary. If the value stored as the root of the given dictionary is also a dictionary, this function will return the root value from that second dictionary. Should all root values be other dictionaries (which would imply that the dictionary at the end of the chain must actually be an earlier dictionary) then RootValue will traverse the chain until it finds a root value which is an earlier dictionary (i.e. the end of the chain before it loops back) and will return that root value. This is the only situation where the command will return a dictionary as the result.
Returns: Varies
Usage: Script or steady state.
Function Groups: Dictionary,  Variable
Related to: Dictionary | MetaData
Format: RootValue( dictionary );
Parameters: Dictionary | MetaData | DictionaryCopy | DictionaryRemove | GetNextKey | GetKeyCount | HasMetaData | IsDictionary | ListKeys
Dictionary
Required. The name of the dictionary to find the root value of.

Example:

RVAL == 5;

A[0] has a unique relationship with Root Values.
If A[0] is first used as a typical key with an assigned value it will behave like a key with a value forever. The value can be changed by assigning a new value to A[0] and is unaffected by anything else.
If A[0] is first assigned a Root Value it's behavior will change. A[0] becomes a variable with Meta Data. The value can be changed by assigning a new value to A[0] OR A[""] OR by using RootValue().

The order of operations matters.
If you set
A[0] = 7
A[""]= 6
and then
A[0]= 5
then A[0] AND A[""] will both equal 5.

However if you first set
A[""] = 6
and then A[0] = 5
then A[""] = 6 and A[0] = 5