<?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 how to create surrogate keys for output tables and do full outer join them? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249248#M33850</link>
    <description>&lt;P&gt;Hi together&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have DBInput and want to&amp;nbsp;push the rows into 4 different DBOutput tables to&amp;nbsp;get a star schema. (it's 1 fact table and 3 dimension tables)&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;In tMap I created for each dimension table a new column as surrogate key by using Expression Numeric.sequence("s1",1,1).&lt;/P&gt; 
&lt;P&gt;schema editor: surrogate keys are datatype int, key flag, null no flag&lt;/P&gt; 
&lt;P&gt;In my fact table i created the surrogate keys of the tables as well to have a foreign key also by using &lt;SPAN&gt;Numeric.sequence("s1",1,1)&lt;/SPAN&gt;.&lt;/P&gt; 
&lt;P&gt;schema editor: surrogate keys are datatype int, but it's not possible to set key flag for all 3 columns (only 1).&amp;nbsp;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Job runs without any failures but the when i do a sql query with all kind of joins the fact table is NULL because it didn't match.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Can someone help me, how to get the matching? Below you can see the screenshots!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks in advance&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fact_table" style="width: 456px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M17B.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139049i9B3BD0E212FAB369/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M17B.jpg" alt="0683p000009M17B.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;fact_table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fact_table_schema" style="width: 642px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M0fc.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137027i3CE759315D4ACE2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M0fc.jpg" alt="0683p000009M0fc.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;fact_table_schema&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dimension_table" style="width: 448px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M15z.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152137i323891890240109A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M15z.jpg" alt="0683p000009M15z.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;dimension_table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dimension_table_schmea" style="width: 654px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M10G.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154680iA4FC1BD1A334395A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M10G.jpg" alt="0683p000009M10G.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;dimension_table_schmea&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Nov 2018 18:40:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-11-14T18:40:04Z</dc:date>
    <item>
      <title>how to create surrogate keys for output tables and do full outer join them?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249248#M33850</link>
      <description>&lt;P&gt;Hi together&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have DBInput and want to&amp;nbsp;push the rows into 4 different DBOutput tables to&amp;nbsp;get a star schema. (it's 1 fact table and 3 dimension tables)&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;In tMap I created for each dimension table a new column as surrogate key by using Expression Numeric.sequence("s1",1,1).&lt;/P&gt; 
&lt;P&gt;schema editor: surrogate keys are datatype int, key flag, null no flag&lt;/P&gt; 
&lt;P&gt;In my fact table i created the surrogate keys of the tables as well to have a foreign key also by using &lt;SPAN&gt;Numeric.sequence("s1",1,1)&lt;/SPAN&gt;.&lt;/P&gt; 
&lt;P&gt;schema editor: surrogate keys are datatype int, but it's not possible to set key flag for all 3 columns (only 1).&amp;nbsp;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Job runs without any failures but the when i do a sql query with all kind of joins the fact table is NULL because it didn't match.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Can someone help me, how to get the matching? Below you can see the screenshots!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks in advance&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fact_table" style="width: 456px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M17B.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139049i9B3BD0E212FAB369/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M17B.jpg" alt="0683p000009M17B.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;fact_table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fact_table_schema" style="width: 642px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M0fc.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137027i3CE759315D4ACE2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M0fc.jpg" alt="0683p000009M0fc.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;fact_table_schema&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dimension_table" style="width: 448px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M15z.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152137i323891890240109A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M15z.jpg" alt="0683p000009M15z.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;dimension_table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dimension_table_schmea" style="width: 654px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M10G.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154680iA4FC1BD1A334395A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M10G.jpg" alt="0683p000009M10G.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;dimension_table_schmea&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 18:40:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249248#M33850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-14T18:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to create surrogate keys for output tables and do full outer join them?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249249#M33851</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; My suggestion will be to always keep the surrogate key sequence within the database&amp;nbsp;and you can always pick the last number+1 from the database when you are calling the next value function.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; Once you extract the next value back from DB to Talend during load time, you can formulate the sequence generation with the first number in Talend sequence from the above value (instead of starting the sequence every time from 1).&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; Could you please try this option and if you get any issues, feel free to comeback with job flow screen shot and the screen shot of the component where you are getting error?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Warm Regards,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Nikhil Thampi&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 04:32:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249249#M33851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-15T04:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to create surrogate keys for output tables and do full outer join them?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249250#M33852</link>
      <description>&lt;P&gt;To be honest I didn't really understand your solution. However, in the meantime I found out my two mistakes: I just wrote the sequence expression next to the column - I didn't create a variable for it. That was the first problem. Second was, that I didn't rename "s1" in sequence expression. I've had three variables named the same so the counting was wrong. Now it works as it should.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you anyway&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 14:18:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249250#M33852</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-15T14:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to create surrogate keys for output tables and do full outer join them?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249251#M33853</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Apologies if my words have confused you.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Let us discuss the flow with an example. You are trying to load the data to Person dimension table and you are allocating new records based on sequence. Assume today you have loaded 10 records to this table. So the surrogate key will have 1 to 10 in the personid column.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Tomorrow, if we are getting another 20 records, the sequence you have created in Talend will again start from 1 to 20. This means the first 10 records out of 20 on day 2 will be rejected due to primary key violation in target table.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hope you are getting the issue what I am highlighting.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Warm Regards,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Nikhil Thampi&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 14:24:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-create-surrogate-keys-for-output-tables-and-do-full-outer/m-p/2249251#M33853</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-15T14:24:08Z</dc:date>
    </item>
  </channel>
</rss>

