# Looking up values in a database

Create a map and use a DatabaseLookup function to get values from a database.

## Before you begin

* You have created an input and an output structure.
* You have created a connection to your database.

## About this task

In this example, two nearly identical JSON files are mapped and one element needs to retrieve its value from a database.

## Procedure

1. In the Hierarchical Mapper, right-click Maps and click New &gt; Map.
2. Select Standard Map and click Next.
3. Select a folder and enter a name for your map, then click Finish.
4. Place your input and output structures in the map.
5. Map your elements.
   ### Example

   In this example, you can drag the input order root on the output order to automatically map all the elements present in both structures.

   ![Example of mapped elements.](https://help.qlik.com/talend/en-US/data-mapper-user-guide/Resources/images/looking_up_values_in_database_01.png)
6. In the Functions tab, select General &gt; DatabaseLookup and drag it to the Value tab of the country\_code element.
7. In the window that opens, select the database column from which you want to retrieve a value, then click OK.
   ### Example

   ![Select output column window.](https://help.qlik.com/talend/en-US/data-mapper-user-guide/Resources/images/looking_up_values_in_database_02.png)
8. Add a condition. If you want to get the country code that matches the country in the input structure, for example, configure it as follows:
   1. Place an Equal function on the Condition.
   2. Place the input country element on the First Value.
   3. Place a DatabaseColumn function on the Second Value.
   4. Select the database column containing the name of the country, NICENAME in this example.
   ### Example

   ![Example of condition.](https://help.qlik.com/talend/en-US/data-mapper-user-guide/Resources/images/looking_up_values_in_database_03.png)

## Results

Your map is now configured and you can test it with a sample document using the Test Run option. In this example, the result looks like this: ![Map result.](https://help.qlik.com/talend/en-US/data-mapper-user-guide/Resources/images/looking_up_values_in_database_04.png)