Using context variables
A few Talend Data Mapper functions
can accept a context variable as a value.
Context variables can be used, for example, to point to a file in the functions WriteURL, ReadURL and GetSequenceFromLocalFile. They can be referenced with the following syntax: ${context.variable_name}.
For example, if you want to write a map output to a different file depending on the context,
you can create a file context variable and assign a file path as its
value.
You can then reference this file in a WriteURL function in your map by
entering file:///${context.file} in the URL field.
They can be used in the same way in your database information, in order to switch between
databases without making any changes to the map. To do this, you first need to create your
database in Talend Data Mapper with the
actual values to import the tables. Then you can update the database information and replace
the values with context variables defined in your Job.
You can also get the value of a context variable using the GetMapProperty function. In this case, the variable should be added in the Property Name field with the following syntax: context.variable_name.