Using a Dictionary in Graphs
The dictionary can be accessed in multiple ways by various components in the graph. It can be accessed from:
Readers and Writers. Both of them support dictionaries as their data source or data target via the File URL attribute.
The dictionary can also be accessed with CTL or Java source code in any component that defines a transformation (all Joiners, Map, Normalizer, etc).
Accessing Dictionary from Readers and Writers
To reference the dictionary parameter in the File URL attribute of a graph component, this attribute must have the following form:
Depending on the type of the parameter in the dictionary and the
processingType, the value can be used either as a name of the input or output file or it can be used directly as data source or data target (i.e.
the data will be read from or written to the parameter directly).
Processing types are the following:
This is the default processing type. It does not need to be specified.
For information about URL in Readers, see also Reading from Dictionary.
This processing type is preselected by default.
If no processing type is specified, stream is used.
For information about URL in Writers, see also Writing to Dictionary.
dict:mountains.csv can be used as either input or output in a Reader or a Writer, respectively (in this case, the property type is
Accessing Dictionary with Java
To access the values from the Java code embedded in the components of a graph, methods of the
org.jetel.graph.Dictionary class must be used.
For example, to get the value of the
heightMin property, you can use a code similar to the following snippet:
In the snippet above, you can see that we need an instance of
TransformationGraph, which is usually available via the
getGraph() method in any place where you can put your own code.
The current dictionary is then retrieved via the
getDictionary() method and finally the value of the property is read by calling the
For further information, see the JavaDoc documentation.
Accessing Dictionary with CTL2
If the dictionary entries should be used in CTL2, they must be defined in the graph. Working with the entries uses standard CTL2 syntax. No dictionary functions are available in CTL2.
For more information, see Dictionary in CTL2.