initializedictionary
DICTIONARY
,
KEY
,
VALUE

The initializedictionary statement builds a new dictionary and initializes it with one or more key/value entries (see Data Dictionaries).


Parameters

This statement has three parameters:

dictionary – is the name of the field or variable that will hold the dictionary.

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 – value of an entry (this may be any type of value).


Description

The initializedictionary statement creates a new collection of values (dictionary) and initializes it with 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 mailingAddress.

local mailingAddress
initializedictionary mailingAddress,"Address","3987 Olive","City","Tustin","State","CA","Zip","92841"

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 includes both numbers and a date.

local inventoryItem
initializedictionary inventoryItem,
    "SKU",10445,"Description","Widget","Price",12.95,
    "On Hand",687,"Last Order Date",date("12/17/2012")

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.


See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6, but now allows values to be any type of data.