<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using tHashOutput and tHashInput to migrate parent/child relationship in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Using-tHashOutput-and-tHashInput-to-migrate-parent-child/m-p/2300893#M73072</link>
    <description>Hi,&lt;BR /&gt;You cannot you a tHashInput before it has been initialized.&lt;BR /&gt;So, you need a first step to populate the tHashOutput (in a sepated subjob), then you can use tHashInput attached to this tHashOutput.&lt;BR /&gt;A trivial, but typical, example should looks like this:&lt;BR /&gt;&lt;PRE&gt;tFileInputDelimited(1)--&amp;gt;tHashOutput&lt;BR /&gt;|&lt;BR /&gt;|&lt;BR /&gt;|on Subjob OK&lt;BR /&gt;|&lt;BR /&gt;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tHashInput&lt;BR /&gt;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;BR /&gt;tFileInputDelimited(2)--&amp;gt;tMap--&amp;gt;tLogRow&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;TRF</description>
    <pubDate>Tue, 13 Dec 2016 14:15:25 GMT</pubDate>
    <dc:creator>TRF</dc:creator>
    <dc:date>2016-12-13T14:15:25Z</dc:date>
    <item>
      <title>Using tHashOutput and tHashInput to migrate parent/child relationship</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tHashOutput-and-tHashInput-to-migrate-parent-child/m-p/2300892#M73071</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I'm fairly new to Talend and I've spent quite a bit of time trying to figure this out this past week and have come across some posts that have gotten me up to this point, and any help would be appreciated. I'm trying migrate some data from a legacy DB to a new system, whose schema containing parent/child relationships is mapped out differently. In the legacy database, I have an child entity (TaPieceJointe) containing document attachments which hold the foreign key to its parent (PceIns). In the target database, this relationship is held in a separate table (modules_relation):&lt;BR /&gt;&lt;BR /&gt;OLD DB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Maps TO ==&amp;gt; NEW DB &lt;BR /&gt;&lt;BR /&gt;TaPieceJointe PceCod &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; docs.count&lt;BR /&gt;TaPieceJointe PceIns&lt;BR /&gt;TaPieceJointe PceNature &lt;BR /&gt;TaPieceJointe PcePME &lt;BR /&gt;TaPieceJointe PceName &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;docs.title&lt;BR /&gt;TaPieceJointe PcePath &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;docs.original_file_name&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;docs.file_type&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;docs.file&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;modules_relation.module_from&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;modules_relation.id_from (FK to equipment table which I used as lookup in tmap1)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;modules_relation.module_to&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;modules_relation.id_to &amp;nbsp;(FK to docs.count)&lt;BR /&gt;&lt;BR /&gt;Between the posts I've come across, they've suggested using tMysqlLastInsertId, tHashOutput and tHashInput. So essentially what I've done is to:&lt;BR /&gt;-insert into the first target table "docs"&lt;BR /&gt;-then try to get the auto-increment key value from "docs" by using tMysqlLastInsertId in order to insert into modules-relation in the target DB, which holds the parent/child relationship between the entities "doc" and "equipment" (entity equivalant to foreign key PceIns).&lt;BR /&gt;&lt;BR /&gt;I've tried to follow as best as possible on how to achieve this, but alas I've come across this latest obstacle where tHashInput is not initialized.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MG7Y.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/143906iC825604AB47536F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MG7Y.png" alt="0683p000009MG7Y.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MG54.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146211i75801511B0487D24/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MG54.png" alt="0683p000009MG54.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MG7d.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142182i5EC24F1B5C9AA813/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MG7d.png" alt="0683p000009MG7d.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 10:11:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tHashOutput-and-tHashInput-to-migrate-parent-child/m-p/2300892#M73071</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-13T10:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using tHashOutput and tHashInput to migrate parent/child relationship</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tHashOutput-and-tHashInput-to-migrate-parent-child/m-p/2300893#M73072</link>
      <description>Hi,&lt;BR /&gt;You cannot you a tHashInput before it has been initialized.&lt;BR /&gt;So, you need a first step to populate the tHashOutput (in a sepated subjob), then you can use tHashInput attached to this tHashOutput.&lt;BR /&gt;A trivial, but typical, example should looks like this:&lt;BR /&gt;&lt;PRE&gt;tFileInputDelimited(1)--&amp;gt;tHashOutput&lt;BR /&gt;|&lt;BR /&gt;|&lt;BR /&gt;|on Subjob OK&lt;BR /&gt;|&lt;BR /&gt;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tHashInput&lt;BR /&gt;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;BR /&gt;tFileInputDelimited(2)--&amp;gt;tMap--&amp;gt;tLogRow&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;TRF</description>
      <pubDate>Tue, 13 Dec 2016 14:15:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tHashOutput-and-tHashInput-to-migrate-parent-child/m-p/2300893#M73072</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2016-12-13T14:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using tHashOutput and tHashInput to migrate parent/child relationship</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-tHashOutput-and-tHashInput-to-migrate-parent-child/m-p/2300894#M73073</link>
      <description>Hello, 
&lt;BR /&gt; 
&lt;BR /&gt;Thanks for the response. What I had trouble with, if you look at the first image was between the first and second tMaps in the flow. I was not able to create a subjob in order to have the tHashOutput initialized. The problem I have is that parent/child reference is modeled differently in the old and new DB, a foreign key is in the old DB, an association in the new DB: 
&lt;BR /&gt; 
&lt;BR /&gt;OLD DB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NEW DB 
&lt;BR /&gt; 
&lt;BR /&gt;instruments &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; =====&amp;gt; equipment &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(this has already been migrated, not in images) 
&lt;BR /&gt; 
&lt;BR /&gt;pieceJointe (holds foreign key to associated instrument) &amp;nbsp;=====&amp;gt; document &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (does NOT hold FK to equipment table; tried to migrate data in first tMap, which also includes a lookup to equipment ID needed to migrate relation into modules_relations table) 
&lt;BR /&gt; 
&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;=====&amp;gt; modules_relations &amp;nbsp;(holds the relation between equipment and document; tried to migrate using second tMap, so I tried to map the flow from first tMap which also contains the equipment ID) 
&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 
&lt;BR /&gt;So basically, I first need to make an insert into the document table, and then its relation to equipment in the modules_relation. From what I've understood and seen, and what TRF has suggested, is that that there needs to be a subjob to do the insert into the modules_relation table, which looks like would be the link between the first and second tMaps, but then I lose the equipment ID value that I got from doing the lookup. How do I carry that value (equipment ID from lookup) *AS WELL* as get the value of *auto_increment* key (document ID) from the insert into documents, as I need both of these values in the modules_relation table? 
&lt;BR /&gt;Thanks again for any insight or guidance!</description>
      <pubDate>Fri, 16 Dec 2016 14:20:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-tHashOutput-and-tHashInput-to-migrate-parent-child/m-p/2300894#M73073</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-16T14:20:57Z</dc:date>
    </item>
  </channel>
</rss>

