mergedictionaries(
DICTIONARY1
,
DICTIONARY2
)

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


Parameters

This function has two parameters:

dictionary1 – is the name of the field or variable that contains the original dictionary (must contain binary data).

dictionary2 – is the name of the field or variable that contains the second dictionary (must contain binary data). You can repeat this parameter for three, four or more dictionaries.


Description

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

fileglobal mailInfo,phoneInfo,emailInfo,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")
emailInfo=initializedictionary("First","Mary","Last","Wilson","Email","mwilson@someisp.com")

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

contactInfo=mergedictionaries(mailInfo,phoneInfo,emailInfo)

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).

emailInfo=initializedictionary("First","Mary","Last","Jackson","Email","mwilson@someisp.com")

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

contactInfo=mergedictionaries(mailInfo,phoneInfo,emailInfo)

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

contactInfo=mergedictionaries(emailInfo,phoneInfo,mailInfo)

See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but now available as a function. Also, this operation now allows more than two dictionaries to be merged.