The mergedictionaries statement merges the contents of two or more dictionaries (see Data Dictionaries).
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.
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:
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 phoneInfo dictionary contained a different last name (perhaps Mary got married).
If the two dictionaries are merged like this, the contactInfo variable will contain the last name Jackson.
However, if the order of the parameters is reversed, the final last name will be Wilson.
Note: The mergedictionaries( function performs the same operation, but within a formula. It also allows more than two dictionaries to be merged at once.
|10.0||Updated||Carried over from Panorama 6.0, but uses new internal dictionary format|