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
-
In the Hierarchical Mapper, right-click
Maps and click .
-
Select Standard Map and click
Next.
-
Select a folder and enter a name for your map, then click
Finish.
-
Drag your input and output structures in the map.
-
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.
-
In the Functions tab,
select and drag it to the Value
tab of the country_code element.
-
In the window that opens, select the database column from which you want to
retrieve a value, then click OK.
Example
-
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:
-
Drag an Equal function on the
Condition.
-
Drag the input country element on the
First Value.
-
Drag a DatabaseColumn function on the Second Value.
-
Select the database column containing the name of the country,
NICENAME in this example.
Example
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: