mergedictionaries
DICTIONARY1
,
DICTIONARY2
,
NAMES

The mergedictionaries statement merges the contents of two or more dictionaries (see Data Dictionaries).


Parameters

This statement has three parameters:

dictionary1 – first dictionary to merge (must contain binary data).

dictionary2 – second dictionary to merge (must contain binary data).

names – is the name of the field or variable that will receive the merged dictionary.


Description

The mergedictionaries statements takes two dictionaries and merges them into a new one. For example, suppose you created two dictionaries with information about a person named Mary Wilson.

fileglobal mailInfo,phoneInfo,contactInfo
mailInfo=initializedictionary("First","Mary","Last","Wilson",
    "Address","3987 Olive","City","Tustin","State","CA","Zip","92841")
phoneInfo=initializedictionary("First","Mary","Last","Wilson","Phone","562-309-5923")

Later, you could use the mergedictionaries statement to create a combined dictionary that contains all of Ms. Wilson’s contact information:

 mergedictionaries mailInfo,phoneInfo,contactInfo

If the the merged dictionaries contain one or more keys that are the same, the value in the dictionary farthest to the right will overide any dictionaries earlier in the list. In the previous example, all three of the dictionaries contained keys for First and Last, but they all contained the same values so there was no conflict. But what if there was a conflict, for example, suppose the e-mail dictionary contained a different last name (perhaps Mary got married).

phoneInfo=initializedictionary("First","Mary","Last","Jackson","Phone","562-309-5923")

If the two dictionaries are merged like this, the contactInfo variable will contain the last name Jackson.

mergedictionaries mailInfo,phoneInfo,contactInfo

However, if the order of the parameters is reversed, the final last name will be Wilson.

mergedictionaries phoneInfo,mailInfo,contactInfo

Note: The mergedictionaries( function performs the same operation, but within a formula. It also allows more than two dictionaries to be merged at once.


See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but uses new internal dictionary format