# Creating a Route to use an external map

Create a Route and configure components to create and use external map variables.

## Procedure

1. In the Integration perspective, right-click the Route Designs node and click Create Route.
2. Enter a name, purpose, and description for your Route, then click Finish.
3. Add the following components to your design workspace and link them with Row &gt; Route connections:
   * A cTimer
   * A cProcessor
   * A cSetBody
   * A cMap
   * A cLog
   * A second cProcessor

   Your Route looks like this: ![Route description.](https://help.qlik.com/talend/en-US/data-mapper-functions-reference-guide/Resources/images/create_route_external_map_01_route.png)
4. Double-click the first cProcessor component and configure it as follows:
   | Parameter | Value |
   | --- | --- |
   | Import | ```<br>import java.util.*;<br>``` |
   | Code | ```<br>Map<String, Object> externalMap = new HashMap<>();<br>externalMap.put("current.date",TalendDate.getCurrentDate());<br>Map<String, Object> executionProperties = exchange.getIn().getHeaders();<br>if (executionProperties==null){<br>executionProperties = new HashMap<>();<br>exchange.getIn().setHeaders(executionProperties);<br>}<br>executionProperties.put("org.talend.transform.externalmap", externalMap);<br>``` |

   This code allows you to create an external map variable named current.date that you can then use in your map.
5. Double-click the cSetBody component and configure it as follows:
   | Parameter | Value |
   | --- | --- |
   | Language | Constant |
   | Expression | "&lt;orders&gt;&lt;order&gt;&lt;orderId&gt;abc-6545165186&lt;/orderId&gt;&lt;shippingDetails&gt;&lt;lastName&gt;Kennedy&lt;/lastName&gt;&lt;firstName&gt;John&lt;/firstName&gt;&lt;street&gt;Santa<br>Rosa South&lt;/street&gt;&lt;city&gt;Columbus&lt;/city&gt;&lt;state&gt;New<br>York&lt;/state&gt;&lt;/shippingDetails&gt;&lt;items&gt;&lt;item&gt;&lt;id&gt;4987601&lt;/id&gt;&lt;price&gt;649.99&lt;/price&gt;&lt;quantity&gt;1&lt;/quantity&gt;&lt;/item&gt;&lt;item&gt;&lt;id&gt;8570817&lt;/id&gt;&lt;price&gt;99.99&lt;/price&gt;&lt;quantity&gt;3&lt;/quantity&gt;&lt;/item&gt;&lt;/items&gt;&lt;/order&gt;&lt;/orders&gt;" |
6. Double-click the second cProcessor component and configure it as follows:
   | Parameter | Value |
   | --- | --- |
   | Code | ```<br>Map<String, Object> executionProperties = exchange.getIn().getHeaders();<br>if (executionProperties==null){<br>executionProperties = new HashMap<>();<br>exchange.getIn().setHeaders(executionProperties);<br>}<br>Map<String, Object> externalMap = (Map<String, Object>)executionProperties.get("org.talend.transform.externalmap");<br>System.out.println("Order ID: " + (String)externalMap.get("order.id"));<br>System.out.println("Order due date: " + (String)externalMap.get("due.date"));<br>``` |

   This code allows you to print the order.id and due.date external map variables that you will define in your map.

## Results

Your Route is configured, you can now generate and configure your map.