Creating a Dictionary

    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
    Figure 256. 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.

      See Dictionary Entry Types below for the list of available types.

    5. Content Type

      For list, map and variant types, the Content Type is used to specify the sub-type, see Dictionary Entry Types below.

    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.

    Dictionary Entry Types

    There are two categories of dictionary entry types - those that can be accessed in CTL2 and the remaining ones.

    CTL Types

    Any of the following types are accessible in CTL2. For detailed information, see Dictionary in CTL2.

    • primitive data types

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

    • multi-value types

      • list - a generic list of elements, the initial value is an empty list.

      • map - a generic mapping from keys to values, the initial value is an empty map.

      • variant - may contain any data type usable in CTL2, typically a JSON-like tree structure. See variant section. The initial value is an empty map or list, which is configurable in the Content Type column.

    List and map entries can 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:

    dictionary collections

    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 list[integer] - a list of integers. New entries are automatically set to list[integer].

    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). New entries are automatically set to map[string, string].

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

    Non-CTL Types
    • object - CloverDX data type available with CloverDX Engine.

    • - 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.

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

    These types are not available in CTL2. They are only accessible by readers and writers or from Java code.

    Dictionary Entry Properties

    Each entry can have some properties (name-value pairs). To add a property, click the Plus button on the right and enter the Name and Value of the new property.