dictionaryfromarray(
ARRAY
,
SUBSEPARATOR
,
SEPARATOR
)

The dictionaryfromarray( function builds a new dictionary and initializes it from a two dimensional text array (see Data Dictionaries and Text Arrays).


Parameters

This function has three parameters:

array – two dimensional text array containing the keys and values for the text array. The first column of the array contains the keys, the second column contains the values.

subseparator – the separator character (or characters) between the columns of the array. If this parameter is missing, the default subseparator is the tab character.

separator – the separator character (or characters) between the rows of the array. If this parameter is missing, the default separator is the carriage return character.


Description

The dictionaryfromarray( function creates a new collection of values (dictionary) and initializes it with one or more key/value pairs from a two dimensional text array. This example creates a new dictionary collection containing a US mailing address.

initializedictionary("Address:3987 Olive,City:Tustin,State:CA,Zip:92841",":",",")

In this example the new dictionary will contain four values: Address, City, State and Zip.

This example takes the output from the sips shell command and converts it into a dictionary.

dictionaryfromarray(arrayfilter(after(lftocr(
    shellscript("sips -g all "+imagefilepath)),cr()),cr(),
    {strip(before(import(),": "))+"¬"+strip(after(import(),": "))}))

The output from the sips shell command is normally something like this:

/Users/jacksmith/Pictures/Flowers.png
 pixelWidth: 1306
 pixelHeight: 916
 typeIdentifier: public.png
 format: png
 formatOptions: default
 dpiWidth: 144.000
 dpiHeight: 144.000
 samplesPerPixel: 4
 bitsPerSample: 8
 hasAlpha: yes
 space: RGB
 profile: sRGB IEC61966-2.1

The formula above converts this into a Panorama dictionary. You can then easily extract items from this dictionary with the getdictionaryvalue( function. (Note: You wouldn’t actually need to use this example, because Panorama already includes an imageinfo( function that performs this for you.)


See Also


History

VersionStatusNotes
10.0NewNew in this version.