36. Dictionary

    Creating a Dictionary

    Using a Dictionary in Graphs

    Dictionary is a data storage object associated with each run of a graph in CloverDX. Its purpose is to provide a simple and type-safe storage of various parameters required by a graph.

    It is not limited to storing only input or output parameters but can also be used as a way of sharing data between various components of a single graph.

    When a graph is loaded from its XML definition file, the dictionary is initialized based on its definition in the graph specification. Each value is initialized to its default value (if any default value is set) or it must be set by an external source (e.g. Data Service, etc.).

    In CTL2 dictionary, entries must always be defined first before they are used. The user needs to use a standard CTL2 syntax for working with dictionaries. No dictionary functions are available in CTL2.

    Between two subsequent runs of any graph, the dictionary is reset to the initial or default settings so that all dictionary runtime changes are destroyed. For this reason, dictionary cannot be used to pass values between different runs of the same graph.

    A dictionary entry must be read and written in different phases. If you write data to a dictionary and read it in the same phase, you may get the previous dictionary entry value. Both components run concurrently and therefore you may read a dictionary before data has been written to it.

    In this chapter, we will describe how a dictionary should be created and how it should be used.