# tHMap Standard properties

These properties are used to configure tHMap running in the Standard Job framework.

The Standard tHMap component belongs to the Processing family.

This component is available in Talend Data Management Platform, Talend Big Data Platform, Talend Real Time Big Data Platform, Talend Data Services Platform, Talend MDM Platform and Talend Data Fabric.

## Basic settings

| Open Map Editor | Click the [...]<br>button to open the tHMap Structure<br>Generate/Select wizard where you can either have the<br>hierarchical mapper structure generated automatically based on the<br>schema, or select an existing hierarchical mapper structure. You must do<br>this for both the input and output sides of your Map. The following<br>lists the options for the output structure:<br><br><ul> <li> <span>Generate hierarchial mapper structure based on the                                        schema</span> option: When you connect multiple output                                    connections to the tHMap, the page displays a confirmation                                    message that informs you that the mapper structures are                                    generated based on the output connections.</li> <li> <span>Select an existing hierarchical mapper                                        structure</span> option: You can connect multiple                                    outputs that are payload-based connections to the tHMap. If                                    there is a single payload-type connection, you can select the                                        <span>Allow support for multiple output                                        connections</span> checkbox. The generated output map                                    inherits from the existing payload structure.</li> </ul><br><br>If Talend Studio detects<br>multiple output connections available, the window displays both output<br>structure options without the support for multiple output connections<br>checkboxes.<br><br>If neither input nor output connection exists, the Structure Selection<br>page is displayed. |
| --- | --- |
| Map Path | Specifies the map to be executed.<br><br>If the map was automatically created using the wizard described above,<br>this is path is set automatically.<br><br>If you want to use an existing map, click the [...] button next to the Map<br>Path field to open a dialog box in which you can select<br>the map you want to use, then click the [...] button next to Open Map<br>Editor to work with the map selected. Note that this map<br>must have previously been created in the<br>Mapping<br>perspective. |
| Read Input As | Select the radio button which corresponds to how you want the input to<br>be read. Depending on your map, only some of the options may be<br>available.<br><br><ul> <li> <p> <span>Data Integration columns</span>                                    (default): Use this option if you are working with <span>Talend Data Integration</span>  metadata.</p> </li> <li> <p> <span>Single column</span>: Use this option                                    if you are working with <span>Talend Data Mapper</span>  metadata.</p> </li> </ul> |
| Write Output As | Select the radio button which corresponds to how you want<br>the output to be written. Depending on your map, only some of the<br>options may be available.<br><br><ul> <li> <p> <span>Data Integration columns</span>                                    (default): Use this option if you are working with <span>Talend Data Integration</span> metadata.</p> </li> <li> <p> <span>String (single                                        column)</span>: Use this option if the data in the                                    output column is to be a <span>String</span>.</p> </li> <li> <p> <span>Byte array (single                                        column)</span>: Use this option if the data in the                                    output column is to be a <span>Byte                                        array</span>.</p> </li> <li> <p> <span>InputStream (single                                        column)</span>: Use this option if you are working with                                        <span>Talend Data Mapper</span> metadata and the input data is a                                    stream.</p> </li> <li> <p> <span>Document (single column)</span>;                                    Use this option if the output column is to be a <span>Document</span>.</p> <div><span>Information note</span><span>Note:</span> If you have selected <span>Document (single                                        column)</span> in the Job you created in versions 6.5                                    or below of <span>Talend Studio</span> and would                                    like to import the same Job to the latest versions 7.0 or                                    onwards, ensure that you have updated the output representation                                    of the map to XML prior to executing the Job. Versions 7.0 or                                    onwards only                                    accept                                    the <span>Document</span> output type with XML                                        representation.</div> </li> </ul> |

## Advanced settings

| Map Variable | In this field, enter a context variable that contains a<br>path to a map. For instance, if you enter *context.mymapfile*, then *mymapfile* can<br>point to different map files at runtime. This can be useful in cases<br>where you want to use multiple maps without creating a new Job each<br>time.<br><br>In the Contexts<br>tab, the value must be an relative path. For instance, assuming you have<br>a map called *mapA* in the folder *Maps/FolderA*, your context variable should<br>contain the value *"FolderA/mapA.xml"*. You can<br>write the path to the file with or without the .xml extension.<br><br>Note that all maps that might be referenced by the<br>context variable must be present in the same Project. This way, when the<br>job is built, it will contain all candidate maps and it will be possible<br>to switch from one to another at runtime.<br><br>For further information on working with<br>context variables, see Talend Studio<br>*User Guide*. |
| --- | --- |
| Alternate contextual Map(s) | From the drop-down list, select a map or several maps that can be<br>referenced by the context variable added in the Map<br>Variable at runtime. When the Job is built, it contains<br>the selected alternate contextual map or maps. For an example scenario<br>on using Alternate contextual Map(s), see [Specifying a map<br>variable and alternate map in tHMap.](https://help.qlik.com/talend/en-US/components/7.2/data-mapping/specifying-map-variable-and-alternate-map-in-thmap "The Map Variable parameter in tHMap allows you to specify a contextual variable that contains a path to a map.") |
| Map each row (disable virtual<br>component) | Select this check box to have tHMap process the input as a single output row. This<br>prevents tHMap from buffering the<br>input rows before delivering them downstream.<br><br>This can be useful, for example, when you use the<br>tHMap component with<br>tSAPIDocReceiver as the input<br>component and any schema-aware component as the output component,<br>because telling the tSAPIDocReceiver component to keep listening forever<br>would otherwise lead to rows never being delivered.<br><br>If the tHMap is<br>used with an input component that can remain open to continuously<br>receive inputs, such as the tRestRequest, this option should be selected. It allows<br>the tHMap to directly process<br>the input received. |
| Log Level | From the drop-down list, select how often you want events<br>to be logged.<br><br><ul> <li> <p> <span>Infrequent</span>: Logs only                                    events related to startup, shutdown and exceptions.</p> </li> <li> <p> <span>Frequent</span> (default): Logs                                    events related to startup, shutdown and exceptions, and once per                                    map execution.</p> </li> <li> <p> <span>Info</span>: Logs all events at                                    an informational level or higher.</p> </li> <li> <p> <span>All</span>: Logs all events.</p> </li> <li> <p> <span>None</span>: Logs nothing.</p> </li> </ul> |
| Exception Threshold | Talend Data Mapper returns an execution status with an severity<br>value which can be OK, Info, Warning, Error or Fatal. By setting the exception threshold, you can<br>specify the severity level at which an exception is thrown, thus<br>enabling downstream components to detect the error in cases other than<br>the default value of Fatal.<br><br>From the drop-down list, select the severity level at<br>which an exception may be thrown during the execution of a map.<br><br><ul> <li> <p> <span>Fatal</span> (default): An                                    exception is thrown when a fatal error occurs. </p> </li> <li> <p> <span>Error</span>: An exception is                                    thrown when an error (or higher) occurs.</p> </li> <li> <p> <span>Warning</span>: An exception is                                    thrown when a warning (or higher) occurs. </p> </li> </ul><br><br>Note that, in order to help you diagnose problems with<br>your map, when you test the map in the Studio, any errors that occur<br>which are at warning level or above will be printed in the console<br>window, regardless of the setting of the Exception Threshold. |
| tStatCatcher Statistics | Select this check box to gather the Job processing<br>metadata at the Job level as well as at each component level. |

## Global Variables

| Global Variables | ERROR\_MESSAGE: the error message generated by the component when an<br>error occurs. This is an After variable and it returns a string. This variable functions<br>only if the Die on error check box<br>is cleared, if the component has this check<br>box.<br><br><br>MapExecutionStatus: returns an object of the<br>org.talend.transform.runtime.common.MapExecutionStatus<br>class<br><br><br>EXECUTION\_SEVERITY: the *Overall<br>Severity* numeric value. This is an After variable and it returns an<br>integer.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>To fill up a field or expression with a<br>variable, press Ctrl + Space to<br>access the variable list and choose the variable to use from it.<br><br>For further information about variables, see *Talend Studio*<br>*User Guide*. |
| --- | --- |

## Usage

| **Usage rule** | tHMap is used for Jobs that<br>require complex data mapping from a variety of different sources.<br><br>The input and output connections can use<br>Talend Data Mapper metadata, Talend Data Integration<br>metadata, or a combination of the two. Each connection is<br>independent.<br><br>When you open the Map Editor for the<br>first time for each connection, it either generates a Talend Data Mapper<br>structure definition based on the schema of the Talend Data Integration<br>component, or allows you to select an existing Talend Data Mapper<br>structure if you are using Talend Data Mapper metadata. It then creates a map<br>with the structure selected or generated.<br><br>This component can be used in several ways:<br><br><ul> <li> <p>You can work with a <span>Talend Data Mapper</span>  map and structures based on <span>Talend Data Mapper</span>  metadata. In this case, the                                        components (for instance, <span>tFileInputRaw</span> and                                            <span>tFileOutputRaw</span>) pass the data in a single                                        column in a single row.</p> <p>For an example of this usage, see <a href="https://help.qlik.com/talend/en-US/components/7.2/data-mapping/thmap-tfileinputraw-tfileoutputraw-tfileoutputraw-using-talend-data-mapper-metadata-standard-component-enterprise-the">Using Talend Data Mapper metadata</a>.</p> </li> <li> <p>You can work with <span>Talend Data Integration</span>  metadata. In this case, you connect                                        an input and output component to <span>tHMap</span> then open the Map                                        Editor without specifying a map path.</p> <p>For an example of this usage, see <a href="https://help.qlik.com/talend/en-US/components/7.2/data-mapping/thmap-tfileinputdelimited-tfileoutputxml-tfileoutputxml-using-talend-data-integration-metadata-standard-component-enterprise-the">Using Talend Data Integration metadata</a>.</p> </li> <li> <p>You can work with a                                        combination of <span>Talend Data Mapper</span>  metadata and                                            <span>Talend Data Integration</span>  metadata.</p> <p>For an example of this usage, see <a href="https://help.qlik.com/talend/en-US/components/7.2/data-mapping/thmap-trowgenerator-tfileoutputraw-tfileoutputraw-transforming-from-data-integration-schema-to-complex-content-schema-standard-component-enterprise-the">Transforming from a Data Integration schema to a complex content schema</a>.</p> </li> <li>You can work with raw file inputs and schema-based input                                    connections as inputs to <span>tHMap</span>. <p>For                                        examples of this usage, see <a href="https://help.qlik.com/talend/en-US/components/7.2/data-mapping/thmap-trowgenerator-generating-output-using-thmap-with-multiple-schema-inputs-spark-batch-component" title="tHMap supports multiple inputs coming from either schema-based input connections or other raw file inputs. In this scenario, you can see how you can generate outputs using schema-based inputs with Main connections to the tHMap component.">Generating the Output Using tHMap with Multiple Schema Inputs</a> and <a href="https://help.qlik.com/talend/en-US/components/7.2/data-mapping/thmap-tfileinputraw-generating-output-using-thmap-with-multiple-payload-inputs-spark-batch-component" title="tHMap allows you to connect multiple payload inputs and generates the output in a single result. In this scenario, you will learn how to create a Job with a tHMap connected to a multiple inputs.">Generating the Output using tHMap with Multiple Payload Inputs</a>.</p> </li> <li>You can work with database tables created in                                        <span>Talend Studio</span>                                    and connect these tables as inputs to <span>tHMap</span>. If you have Jobs that use the                                    DatabaseLookup function, see <a href="https://help.qlik.com/talend/en-US/components/7.2/data-mapping/migrating-from-databaselookup-to-thmap" title="If you have Jobs that use the DatabaseLookup function, you can migrate these to use the multi-input feature of tHMap.">Migrating from DatabaseLookup to tHMap</a> for the steps on how to migrate                                    to tHMap.</li> <li>You have the option to connect tHMap to multiple database output                                    connections. To migrate previously created Jobs using IO                                    Database functions, see <a href="https://help.qlik.com/talend/en-US/components/7.2/data-mapping/migrating-io-database-functions-to-thmap-multi-output-database-connections" title="tHMap supports multiple output connections. If you have previously created a Job using the IO Database functions, you can migrate these into using the multi-output feature.">Migrating IO Database functions to tHMap Multi-Output                                        Database Connections</a>.</li> <li>You can connect <span>tHMap</span> to multiple output                                    connections using raw file, schema-based connections, and                                    payload-based connections.</li> <li> <p> <a href="https://help.qlik.com/talend/en-US/components/7.2/data-mapping/thmap-tjava-tfixedflowinput-tjavarow-handling-errors-standard-component-enterprise-this">Handling errors</a> shows how to handle error conditions using the <span>tHMap</span> component.</p> </li> <li> <p>For a thMap with a single connection, the Wrap Structure                                        option (Allow tHMap to support multiple inputs/outputs) is,                                        by default, unchecked for these options: <span>Generate                                            from Schema</span> (schema-based) and                                            <span>Select From Existing Structure</span>                                        (payload-type).</p> </li> </ul> |
| --- | --- |
| **Advanced use case** | <ul> <li>For the output Structure of the <span>thMap</span>, you can also use the                                    <span>WriteURL</span> function in                                    <span>Talend Data Mapper</span> .                                In case the output Structure of the <span>tHMap</span> includes both a connection to a <span>Talend Data Integration</span>  metadata or                                component and a <span>WriteURL</span>                                function, the <span>WriteURL</span> value                                takes precedence. <span>Talend Data Integration</span> metadata or component does not receive any                                data from <span>tHMap</span>. </li> <li> <p>Using <span>tHMap</span>, you can test the generated                                        <span>Talend Data Mapper</span>                                    Map in <span>Test Run</span> mode. </p> <div>To use the feature, ensure that you have a compatible input                                    document of CSV format with these properties:<ul> <li>the default delimiter is the (,) comma;</li> <li>the system default line separator is used as the                                            newline;</li> <li>there exists no header row in the input file;</li> <li>there will be no header row in the output file.</li> </ul> </div> <p>Specify your input document in <span><span>Show Document</span> &gt; <span>Select Sample Input Document</span> &gt; <span>Select Resource/Import Document</span></span>.</p> <p>To execute the transformation, click <span>Test Run</span>. After execution, your                                    generated output document is in CSV format, which you can save                                    by clicking <span>Save to                                    File</span>. To configure this feature, see Test                                    preferences in the <span>Talend Data Mapper</span> User Guide.</p> <div><span>Information note</span><span>Tip:</span> If you have multiple inputs and outputs in your                                    Map, specify an input document for each row or each ReadURL map                                    element. To execute, use the <span>Test Run to External                                        Output</span> option and specify a file URL for each                                    WriteURL in the output structure of the Map.</div> </li> </ul> |
| **Limitations** | <ul> <li>If you created a tHMap with multiple input or output connections,                                you can only add new schema-based input or output connections. </li> <li>When you add a new connection with a single column, you cannot                                associate it with a payload structure. The Map Regeneration                                mechanism only generates a single-element record for the new                                connection.</li> <li>If you rename a payload-type connection, regenerate the                                corresponding map and its structure by double-clicking on the tHMap                                before closing the Job editor. The renamed record structure then                                contains the payload structure. </li> <li>If in the event that you closed the Job prior to regenerating a                                renamed payload-type connection, the system treats the connection as                                a schema-type connection. The payload structure does not get                                associated with the new name.</li> <li>A Job containing a tHMap cannot be deployed as an OSGi bundle with                                the old Eclipse-based runtime.</li> </ul> |

Information noteNote:

* For further information about performing transformations using Talend Data Mapper , see Talend Data Mapper User Guide.

* When using representations other than Map, CSV, Avro, XML, and Cobol, running this component with the old Eclipse-based Runtime may create temporary folders, which are not automatically removed after stopping the Runtime. If you frequently run Talend Data Mapper, these files may pile up and eventually lead to a disk full error. When the error occurs, the runtime fails. To avoid this, ensure that you perform periodical cleaning. For more information, see [Cleaning up temporary folders and files](https://help.qlik.com/talend/r/en-US/7.2/data-mapper-user-guide/cleaning-up-temporary-folders-and-files).