setglobaldictionaryvalues
DICTIONARY
,
KEY
,
VALUE

The setglobaldictionaryvalues statement sets one or more key/value pairs in a global dictionary.


Parameters

This statement has three parameters:

dictionary – is the name of the dictionary to be created/modified.

key – is the name of the key the value (next parameter). You may repeat multiple key/value parameters.

value – is the value to be associated with the key (previous parameter). This may be text, a number, or binary data.


Description

This statement sets one or more key/value pairs in a global dictionary. For example, this code sets up a private dictionary with three values: Color, Scale and Size.

setglobaldictionaryvalues "MyValues","Color","Violet","Scale",80,"Size","Large"

Later, you can use the globaldictionaryvalue( function to retrieve any of these values, for example the scale.

globaldictionaryvalue("MyValues","Scale") ☞ 80

If you need to change the scale value, you can do so at any time with another setglobaldictionaryvalues statement, like this:

setglobaldictionaryvalues "MyValues","Scale",45

This will change the scale value while leaving the color and size (and any other values) alone.

The setglobaldictionaryvalues statement can also be used to convert a regular dictionary into a global dictionary, or to merge a regular dictionary with an existing global dictionary. In either case, the second parameter is the regular dictionary you want to convert, and there is no third parameter. The following is effectively the same as the first example. The advantage of this approach is that you can use all of Panorama’s tools for building and modifying dictionaries to set up the data, so the key/value pairs don’t have to be fixed in advance when the code is written.

let iteminfo = initializedictionary("Color","Blue","Scale",30,"Size",Small")
setglobaldictionaryvalues MyValues,iteminfo

When the specified global dictionary already exists, where the same key exists in both dictionaries its value in the regular dictionary replaces the existing value for that key in the global dictionary, and key/value pairs are added to the global dictionary for any new keys from the regular dictionary.

See Global Dictionaries for an extended discussion of how this statement can be used.


See Also


History

VersionStatusNotes
10.2NewNew in this version.