<?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 Problems Merging Fields in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457185#M98549</link>
    <description>&lt;DIV&gt;I am trying to populate a field in a joined table with a field in the first part of the join [org_id] - see the code in bold.&lt;BR /&gt;&lt;BR /&gt;I get an error saying org_id not found. - I am sure this will be soomething really simple but my brain has stopped functioning.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;[Organizations]:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; id as [org_id],&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; org_name,&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isDeleted,&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isSubsidiary&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;//&amp;nbsp; if(isSubsidiary=0, id) as [main_id]&lt;/DIV&gt;
&lt;DIV&gt;WHERE isDeleted = 0;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;SELECT&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; id,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; `org_name`,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isDeleted,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isSubsidiary,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isMainco&lt;/DIV&gt;
&lt;DIV&gt;FROM `db`.organizations;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Left Join ([Organizations]) LOAD [sub_id] as org_id,&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; sub_id,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; main_id,&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;if(ISNULL([main_id]), [org_id]) as NewField;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;SELECT `sub_id`,&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; `main_id`&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;FROM `db`.subsidiary;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Any help appreciated,&lt;/DIV&gt;
&lt;DIV&gt;Mark&lt;/DIV&gt;</description>
    <pubDate>Tue, 28 May 2024 19:19:35 GMT</pubDate>
    <dc:creator>Markbhai</dc:creator>
    <dc:date>2024-05-28T19:19:35Z</dc:date>
    <item>
      <title>Problems Merging Fields</title>
      <link>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457185#M98549</link>
      <description>&lt;DIV&gt;I am trying to populate a field in a joined table with a field in the first part of the join [org_id] - see the code in bold.&lt;BR /&gt;&lt;BR /&gt;I get an error saying org_id not found. - I am sure this will be soomething really simple but my brain has stopped functioning.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;[Organizations]:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; id as [org_id],&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; org_name,&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isDeleted,&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isSubsidiary&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;//&amp;nbsp; if(isSubsidiary=0, id) as [main_id]&lt;/DIV&gt;
&lt;DIV&gt;WHERE isDeleted = 0;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;SELECT&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; id,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; `org_name`,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isDeleted,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isSubsidiary,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isMainco&lt;/DIV&gt;
&lt;DIV&gt;FROM `db`.organizations;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Left Join ([Organizations]) LOAD [sub_id] as org_id,&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; sub_id,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; main_id,&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;if(ISNULL([main_id]), [org_id]) as NewField;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;SELECT `sub_id`,&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; `main_id`&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;FROM `db`.subsidiary;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Any help appreciated,&lt;/DIV&gt;
&lt;DIV&gt;Mark&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 May 2024 19:19:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457185#M98549</guid>
      <dc:creator>Markbhai</dc:creator>
      <dc:date>2024-05-28T19:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problems Merging Fields</title>
      <link>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457187#M98550</link>
      <description>&lt;P&gt;Replace&amp;nbsp;&lt;STRONG&gt;org_id&lt;/STRONG&gt; with&amp;nbsp;&lt;STRONG&gt;sub_id&lt;/STRONG&gt;. At that point in your Load Script, loading data from &lt;SPAN&gt;&lt;STRONG&gt;subsidiary&lt;/STRONG&gt;,&amp;nbsp;&lt;/SPAN&gt;the field&amp;nbsp;&lt;STRONG&gt;org_id&lt;/STRONG&gt; does not exist.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Left Join ([Organizations]) 
LOAD 
   [sub_id] as org_id,
   sub_id,
   main_id,
   if(ISNULL([main_id]), [sub_id]) as NewField
;
SELECT 
   `sub_id`,
   `main_id`
FROM 
   `db`.subsidiary
;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 May 2024 19:48:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457187#M98550</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-05-28T19:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problems Merging Fields</title>
      <link>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457193#M98551</link>
      <description>&lt;P&gt;The issue I have is that the organizations table contains all of the companies, which may be a parent or a subsidiary, but this table does not allow us to link a parent to a subsidiary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The subsidiary table does the linking, but lists organisations which have parents and subsidiaries (i.e the companies witout a subsidiary are not listed in the subsidiary table.&lt;/P&gt;
&lt;P&gt;Therefore if main_id is null, so is the sub_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Markbhai_0-1716927028806.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/166994iC1524C27CFD1D875/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Markbhai_0-1716927028806.png" alt="Markbhai_0-1716927028806.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I want to achieve is for the field currently lables as main_id in this table to be populated with the org_id when there is no entry in the subsidiary table. i.e. in the third line does it would contain 39&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mark.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 20:11:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457193#M98551</guid>
      <dc:creator>Markbhai</dc:creator>
      <dc:date>2024-05-28T20:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problems Merging Fields</title>
      <link>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457196#M98552</link>
      <description>&lt;P&gt;It seems like I got there in the end:&lt;/P&gt;
&lt;DIV&gt;[organizations]:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; id as [org_id],&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; org_name,&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isDeleted,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isSubsidiary&lt;/DIV&gt;
&lt;DIV&gt;WHERE isDeleted = 0;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;SELECT&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; id,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; `org_name`,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isDeleted,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isSubsidiary,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; isMainco&lt;/DIV&gt;
&lt;DIV&gt;FROM `db`.organizations;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Left Join([organizations])&lt;/DIV&gt;
&lt;DIV&gt;//[subsidiary]:&lt;/DIV&gt;
&lt;DIV&gt;LOAD [sub_id] as [org_id],&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; sub_id,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; main_id,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp;;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;SELECT `sub_id`,&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; `main_id`&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;FROM `db`.subsidiary;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;TempTable_tmp:&lt;/DIV&gt;
&lt;DIV&gt;Load&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; [org_id] as orgnew,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; [sub_id] as subnew,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; [main_id] as mainnew,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; if(ISNULL([main_id]), [org_id], [main_id]) as NewField&lt;/DIV&gt;
&lt;DIV&gt;Resident [organizations];&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thanks Marcus, it was your comment regarding the org_id not being present that made me consider a new table from the old one.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 May 2024 20:27:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problems-Merging-Fields/m-p/2457196#M98552</guid>
      <dc:creator>Markbhai</dc:creator>
      <dc:date>2024-05-28T20:27:01Z</dc:date>
    </item>
  </channel>
</rss>

