This article is available as a PDF here.
Maps are a productive way to transfer the fields of a source to a target using a graphical tool. When there's a one-to-one correspondence between source and target fields, the map can be created with a simple drag-and-drop. However, sometimes the map may require some logic or special processing in certain fields.
Examples of this special processing include
Specifying a default value
In tMap, you can put these variables in three places:
- In the target field Expression,
- As a Var, or
- In a tSetGlobalVar
IN THE TARGET FIELD
Writing expressions in the target field is a concise way to process a field. The target field Expression features an Expression Builder.
|Expression Defined in Target field|
AS A VAR
If your expression needs to be used throughout the map's fields, you can create a variable in the same window.
Notice that the variable is preceded with 'Var'.
This step involves adding another component to the canvas. In addition to tMap, add a tSetGlobalVar component. Rather than connecting the input Excel connection to the tMap, put the tSetGlobalVar in between. This will require re-mapping the source and target fields; use the row of the tSetGlobalVar rather than the Excel file.