The setdictionaryvalue statement changes a value in a dictionary (see Data Dictionaries).
This statement has three parameters:
dictionary – the dictionary to modify (must contain binary data).
key – name of an entry (this must be a text value). If this key doesn’t exist within the dictionary, it is created.
value – new value of this item (this may be any type of value).
The setdictionaryvalue statement takes an existing collection of values (dictionary) and modifies one or more key/value pairs within it. This example creates a new dictionary collection containing a US mailing address and stores it in a variable named mailto.
fileglobal mailto mailto=initializedictionary("Address","3987 Olive","City","Tustin","State","CA","Zip","92841")
Later you could use the setdictionaryvalue statement to modify one of the values in the dictionary.
setdictionaryvalue mailto,"Address","3987 Olive Court" setdictionaryvalue mailto,"Zip","92841-8437"
You can see the changed values by using the dumpdictionaryquoted( function.
Here is the result:
Address="3987 Olive Court" City="Tustin" State="CA" Zip="92841-8437"
The statement can also add new key/value pairs to the dictionary.
setdictionaryvalue mailto,"Country","United States" setdictionaryvalue mailto,"State Name","California"
Two new values have been added to the dictionary collection.
Addres="3987 Olive Court" City="Tustin" State="CA" Zip="92841-8437" Country="United States" State Name="California"
You can also add these two new key/value pairs with a single statement, like this:
setdictionaryvalue mailto,"Country","United States","State Name","California"
You can include as many key value pairs as you want.
Dictionary values are not restricted to text – you can use any type of data that Panorama supports, including numbers, dates, and binary data. This example adds a “next checkup” date to the dictionary.
setdictionaryvalue mailto,"Next Checkup",date("2/17/2014")
Advanced Note: If you used dictionaries in a previous version of Panorama (6.0 or earlier), the internal format used for dictionary collections has changed. The older version supported only MacOSRoman encoded text (no Unicode text), and did not support non text values. The new format lifts both of these restrictions. The old format is still supported in “read-only” mode – the data in an old format dictionary can still be accessed, but will automatically be converted to the new format if any changes are made.
Note: The changedictionaryvalues( function performs the same operation, but within a formula. It also allows more than one value to be set at once.
|10.0||Updated||Carried over from Panorama 6.0, but uses new internal dictionary format. Also now allows multiple key/value pairs.|