changedictionaryvalues(
DICTIONARY
,
KEY
,
VALUE
)
The changedictionaryvalues( function changes one or more values in a dictionary (see Data Dictionaries).
Parameters
This function has three parameters:
dictionary – is the name of the field or variable that contains the dictionary (must contain binary data).
key – name of an entry (this must be a text value). You can have more than one key parameter, as long as each key is accompanied by an associated value parameter.
value – The new value to be paired with the key.
Description
The changedictionaryvalues( function takes an existing collection of values and modifies one or more key/value pairs. 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 changedictionaryvalues( function to modify one or more of the values in the dictionary. (In this example the modified dictionary is being stored right back into the mailto variable, but it could be stored in a different field or variable.)
mailto=changedictionaryvalues(mailto,"Address","3987 Olive Court","Zip","92841-8437")
You can see the changed values by using the dumpdictionaryquoted( function.
dumpdictionaryquoted(mailto)
Here is the result:
Zip="92841-8437"
Address="3987 Olive Court"
City="Tustin"
State="CA"
The function can also add new key/value pairs to the dictionary.
mailto=changedictionaryvalues(mailto,"Country","United States","State Name","California")
Two new values have been added to the dictionary collection.
Zip="92841-8437"
Address="3987 Olive Court"
City="Tustin"
State="CA"
Country="United States"
State Name="California"
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.
mailto=changedictionaryvalues(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.
Error Messages
Changedictionaryvalues( function is missing a value parameter. – This function requires an odd number of parameters. If an even number of parameters is supplied, this error will occur.
See Also
- appenddictionaryvalue -- appends a value to an item in a dictionary (see Data Dictionaries).
- changedictionaryname -- changes the name (key) of an item in a dictionary (see Data Dictionaries).
- classicdictionaryvalue( -- returns the value of an item in the dictionary, given its key (see Data Dictionaries). Unlike getdictionaryvalue(, this function does not treat keys as case sensitive.
- clearglobaldictionaryvalues -- clears (removes) all the keys and values from the specified global dictionary.
- copypartialdictionary -- builds a new dictionary and initializes it with values from an existing dictionary (see Data Dictionaries).
- copypartialdictionary( -- partially copies a dictionary (see Data Dictionaries).
- Data Dictionaries -- Overview of Panorama's key/value data dictionaries.
- deletedictionaryvalue -- deletes a key/value pair from a dictionary (see Data Dictionaries).
- deletedictionaryvalue( -- deletes one or more key/value pairs from a dictionary (see Data Dictionaries).
- deleteglobaldictionaryvalues -- deletes one or more global dictionary values.
- dictionaryassignmentscode( -- returns code that can be used to take the values in a dictionary (see Data Dictionaries) and assign them to fields or variables based on the dictionary keys.
- dictionarydifference -- builds an array that lists keys of dictionary values that are different between two dictionaries (see Data Dictionaries).
- dictionaryfromarray( -- builds a new dictionary and initializes it from a two dimensional text array (see Data Dictionaries and Text Arrays).
- dictionaryfromvariables( -- builds a new dictionary and initializes it from a list of variables (carriage return delimited).
- dictionaryvalueexists -- returns true or false depending on whether or not a key/value pair exists in a dictionary (see Data Dictionaries).
- dictionaryvalueexists( -- returns true or false depending on whether or not a key/value pair exists in a dictionary (see Data Dictionaries).
- dumpdictionary -- returns a carriage return separated array of dictionary keys and values (see Data Dictionaries).
- dumpdictionary( -- returns a carriage return separated array of dictionary keys and values (see Data Dictionaries).
- dumpdictionaryquoted -- returns a carriage return separated array of dictionary keys and values (see Data Dictionaries).
- dumpdictionaryquoted( -- returns a carriage return separated array of dictionary keys and values (see Data Dictionaries). The text values are quoted.
- dumpdictionarysource( -- returns a carriage return separated array of dictionary keys and values (see Data Dictionaries). The keys and values are quoted so that they could be used to re-assemble the dictionary with the initializedictionary( function.
- getdictionarykey -- returns the key of an item in the dictionary, given its value. This is essentially the opposite of the getdictionaryvalue( function (see Data Dictionaries).
- getdictionarykey( -- returns the key of an item in the dictionary, given its value). This is essentially the opposite of the getdictionaryvalue( function (see Data Dictionaries).
- getdictionaryvalue -- returns the value of an item in the dictionary, given its key (see Data Dictionaries).
- getdictionaryvalue( -- returns the value of an item in the dictionary, given its key (see Data Dictionaries).
- getglobaldictionary( -- converts a global dictionary into a regular dictionary.
- getstructurevalue( -- extracts a value from a structure of nested Data Dictionaries and/or Data Arrays.
- Global Dictionaries -- alertnate high performance method to store multiple data items, much faster than regular data dictionaries.
- globaldictionarybuild -- builds a global dictionary by scanning a database.
- globaldictionarykeys( -- returns a cr()-separated array containing the keys in a global dictionary, or the names of all global dictionaries.
- globaldictionaryvalue( -- returns the value of an item in a global dictionary, given its key (see Global Dictionaries).
- info("timerinfo") -- returns a dictionary that contains all of the properties of the currently running timer.
- initializedictionary -- builds a new dictionary and initializes it with one or more key/value entries (see Data Dictionaries).
- initializedictionary( -- builds a new dictionary and initializes it with zero or more key/value entries (see Data Dictionaries).
- initializedictionaryvalue( -- builds a new dictionary and initializes it with one or more entries (see Data Dictionaries). This function is deprecated, we recommend using the initializedictionary( function instead.
- listdictionarykeys( -- returns a list of the keys in a dictionary collection.
- listdictionarynames -- returns a list of the names (keys) in a dictionary (see Data Dictionaries).
- mergedictionaries -- merges the contents of two or more dictionaries (see Data Dictionaries).
- mergedictionaries( -- merges the contents of two or more dictionaries (see Data Dictionaries).
- renamedictionarykey( -- changes the key (name) of one or more values in a dictionary (see Data Dictionaries).
- setdictionaryvalue -- changes a value in a dictionary (see Data Dictionaries).
- setglobaldictionaryvalues -- sets one or more key/value pairs in a global dictionary.
- setlocalsfromdictionary -- converts a dictionary into a collection of local variables. The names and values of the local variables will be derived from the dictionary contents.
- soundinfo( -- returns a dictionary that contains all of the properties of a sound.
- timerinfo( -- returns a dictionary that contains all of the properties of a timer.
History
10.0 | Updated | Carried over from Panorama 6.0, but now allows more than one key/value pair to be changed at a time. This operation is now available as a function that can be used a formula -- it was previously only available as the setdictionaryvalue statement (which still works for compatibility with older databases). |