<?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 Replacing partner ID with the parent partner ID if available in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Replacing-partner-ID-with-the-parent-partner-ID-if-available/m-p/1383745#M31626</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Partners table and a Facts table, linked on the field %PartnerKey.&lt;/P&gt;&lt;P&gt;Now some partners have a parent record.&amp;nbsp; In this case I want to replace the %PartnerKey in the Facts table with the key of the parent.&lt;/P&gt;&lt;P&gt;I have some code to do this, but keep bouncing into the fact that the Staging table is not properly loaded.&amp;nbsp; I don't see where the mistake is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the code.&amp;nbsp; Can someone direct me into what I am doing wrong ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tx,&lt;/P&gt;&lt;P&gt;Seppe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FactsStageXYZ:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 as temptest&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //need to add an additional field, otherwise table is not loaded ??&lt;/P&gt;&lt;P&gt;resident Facts;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left join(Facts)&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %PartnerKey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(len(PartnerParentId)&amp;gt;0,&amp;nbsp; &lt;SPAN style="font-size: 10pt;"&gt;PartnerParentId, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;%PartnerKey) as NewPartnerKey&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Resident Partners;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Facts;&lt;/P&gt;&lt;P&gt;Drop field %PartnerKey from FactsStageXYZ;&lt;/P&gt;&lt;P&gt;Rename field NewPartnerKey to %PartnerKey;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Error that %PartnerKey already exists&lt;/P&gt;&lt;P&gt;RENAME TABLE FactsStageXYZ to Facts;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 10 Sep 2017 09:03:45 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-09-10T09:03:45Z</dc:date>
    <item>
      <title>Replacing partner ID with the parent partner ID if available</title>
      <link>https://community.qlik.com/t5/App-Development/Replacing-partner-ID-with-the-parent-partner-ID-if-available/m-p/1383745#M31626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Partners table and a Facts table, linked on the field %PartnerKey.&lt;/P&gt;&lt;P&gt;Now some partners have a parent record.&amp;nbsp; In this case I want to replace the %PartnerKey in the Facts table with the key of the parent.&lt;/P&gt;&lt;P&gt;I have some code to do this, but keep bouncing into the fact that the Staging table is not properly loaded.&amp;nbsp; I don't see where the mistake is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the code.&amp;nbsp; Can someone direct me into what I am doing wrong ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tx,&lt;/P&gt;&lt;P&gt;Seppe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FactsStageXYZ:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 as temptest&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //need to add an additional field, otherwise table is not loaded ??&lt;/P&gt;&lt;P&gt;resident Facts;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left join(Facts)&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %PartnerKey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(len(PartnerParentId)&amp;gt;0,&amp;nbsp; &lt;SPAN style="font-size: 10pt;"&gt;PartnerParentId, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;%PartnerKey) as NewPartnerKey&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Resident Partners;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Facts;&lt;/P&gt;&lt;P&gt;Drop field %PartnerKey from FactsStageXYZ;&lt;/P&gt;&lt;P&gt;Rename field NewPartnerKey to %PartnerKey;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Error that %PartnerKey already exists&lt;/P&gt;&lt;P&gt;RENAME TABLE FactsStageXYZ to Facts;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Sep 2017 09:03:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Replacing-partner-ID-with-the-parent-partner-ID-if-available/m-p/1383745#M31626</guid>
      <dc:creator />
      <dc:date>2017-09-10T09:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing partner ID with the parent partner ID if available</title>
      <link>https://community.qlik.com/t5/App-Development/Replacing-partner-ID-with-the-parent-partner-ID-if-available/m-p/1383746#M31627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the beginning you load all the fields from the Facts to &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;FactsStageXYZ and a big synthetic key is resulting so that;s why you need to put the "&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;temptest&lt;/SPAN&gt;" field. You could Qualify the fields you want to take from the Facts table to your new &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;FactsStageXYZ.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;if&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;NewPartnerKey is the new key you want to use then before renaming it you could drop the old &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;%PartnerKey or raname it so you don;t get the Error. Also i think you can write like this the left join:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;"Left join(Facts)&lt;/P&gt;&lt;P&gt;Load&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(len(PartnerParentId)&amp;gt;0,&amp;nbsp; PartnerParentId, %PartnerKey) as %PartnerKey&lt;/P&gt;&lt;P&gt;Resident Partners;"&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;I really don;t understand why you are load the facts again in in the &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;FactsStageXYZ...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Hope it helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Andrei&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2017 15:02:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Replacing-partner-ID-with-the-parent-partner-ID-if-available/m-p/1383746#M31627</guid>
      <dc:creator>andrei_delta</dc:creator>
      <dc:date>2017-09-11T15:02:54Z</dc:date>
    </item>
  </channel>
</rss>

