Creating a Dictionary

The dictionary specification provides so called "interface" of the graph and is always required, even, for example, when the graph is used with Launch Service.

In the source code, the entries of the dictionary are specified inside the <Dictionary> element.

To create a dictionary, right-click the Dictionary item in the Outline pane and choose Edit from the context menu. The Dictionary editor will open.

Dictionary Dialog with Defined Entries

Figure 38.1. Dictionary Dialog with Defined Entries


Click the Plus sign button on the left to create a new dictionary entry.

After that, specify its Name. You must also specify other properties of the entry:

  1. Name

    Specifies the name of the dictionary entry.

    Names are case-sensitive and must be unique within the dictionary. Generally, a dictionary name does not have to be a valid Java identifier. For example, a dictionary name in the >File URL attribute does not require this condition to be met. We recommend using legal Java identifiers since an access to a dictionary in CTL requires the dictionary name to be a legal Java identifier.

  2. As Input

    Specifies whether the dictionary entry can be used as an input or not. Its value can be true or false.

  3. As Output

    Specifies whether the dictionary entry can be used as an output or not. Its value can be true or false.

  4. Type

    Specifies the type of the dictionary entry.

    Dictionary types are the following primitive CloverDX data types:

    • boolean, byte, date, decimal, integer, long, number and string.

    Any of these can also be accessed in CTL2. For detailed information, see Dictionary in CTL2.

    Additionally, there are two types of multi-value dictionary entries:

    • list - a generic list of elements

    • map - a generic mapping from keys to values

    For further information about multi-value data types in CloverDX, see Multivalue Fields.

    [Tip]Tip

    Both list and map dictionary entries can also be accessed in CTL2, but you need to specify the type of elements of the list or map in the Content Type column, see the picture below:

    For example, if you create a dictionary entry of the type list and set the Content Type to integer, you can access the entry in CTL2 as integer[] - a list of integers.

    Similarly, if you create a dictionary entry of the type map and set the Content Type to number, you can access the entry in CTL2 as map[string, number] - a mapping from string keys to number values (the keys are always assumed to be of the string data type).

    There are three other data types of dictionary entries (available in Java):

    • object - CloverDX data type available with CloverDX Engine.

    • readable.channel - the input will be read directly from the entry by the Reader according to its configuration. Therefore, the entry must contain data in valid format.

    • writable.channel - the output will be written directly to this entry in the format given by the output Writer (e.g. text file, XLS file, etc.)

  5. Content Type

    This specifies the content type of the output entry. This content type will be used, for example, when the graph is launched via Launch Service to send the results back to user.

  6. Initial Value

    A default value of an entry - useful when executing the graph without actually populating the dictionary with external data. Note that you cannot edit this field for all data types (e.g. object). As you set a new Initial Value, a corresponding name-value pair is created in the Properties pane on the right. Initial value is therefore the same as the first value you have created in that pane.

Each entry can have some properties (name and value). To specify them, click the corresponding button on the right and specify the following two properties: