<?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 Partial Load with Merge and Composite Key in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Partial-Load-with-Merge-and-Composite-Key/m-p/2114814#M90987</link>
    <description>&lt;P&gt;Hey folks,&lt;/P&gt;
&lt;P&gt;I'm currently getting a grasp on the partial load functionality of Qlik Sense and implementing some of the methods in one of my business applications (Add/Replace/Merge).&lt;/P&gt;
&lt;P&gt;Now there are limited resources to get information from so I'm hoping to get an answer here.&amp;nbsp; I want to merge data into an existing table during a partial reload based on a composite key. The data is loaded from a csv and stored afterwards.&lt;/P&gt;
&lt;P&gt;Because the key doesn't exist in the original csv-file, I have to build it first by concatenating two fields and then compare with the previously loaded/stored data. To do this, I'm using a preceding load:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Merge (LastPatUpdate) on PatKey Concatenate(Patient_Staging)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Load&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If(Exists(PatKey), 'U', 'I') As Operation,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;*;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Load&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;MVZKUERZEL &amp;amp; '_' &amp;amp; PATNR As PatKey,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;PATNR,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;GEBDATUM As Geburtsdatum,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If(GESCHLECHT = 'männlich' or GESCHLECHT = 'weiblich', GESC&lt;/STRONG&gt;HLECHT, 'Sonstiges') As Geschlecht,&lt;BR /&gt;&lt;STRONG&gt;PLZ As PatPLZ,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;MVZKUERZEL,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;UPDAT As LastPatUpdate&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;From ['$(file)']&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;(txt, codepage is 28591, embedded labels, delimiter is '|', msq);&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now if I run this, the record (even if the PatKey exists) is inserted every time and not updated with the new value. I think the problem comes from the preceding load as it has the same structure as the previously loaded table from my stored QVD - so the exist function will not lookup the old data but the first table of the preceding load.&lt;BR /&gt;&lt;BR /&gt;Is there any other way to deal with composite keys while using the merge command?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any helpful information!&lt;/P&gt;</description>
    <pubDate>Fri, 08 Sep 2023 06:10:52 GMT</pubDate>
    <dc:creator>alliedarmour</dc:creator>
    <dc:date>2023-09-08T06:10:52Z</dc:date>
    <item>
      <title>Partial Load with Merge and Composite Key</title>
      <link>https://community.qlik.com/t5/App-Development/Partial-Load-with-Merge-and-Composite-Key/m-p/2114814#M90987</link>
      <description>&lt;P&gt;Hey folks,&lt;/P&gt;
&lt;P&gt;I'm currently getting a grasp on the partial load functionality of Qlik Sense and implementing some of the methods in one of my business applications (Add/Replace/Merge).&lt;/P&gt;
&lt;P&gt;Now there are limited resources to get information from so I'm hoping to get an answer here.&amp;nbsp; I want to merge data into an existing table during a partial reload based on a composite key. The data is loaded from a csv and stored afterwards.&lt;/P&gt;
&lt;P&gt;Because the key doesn't exist in the original csv-file, I have to build it first by concatenating two fields and then compare with the previously loaded/stored data. To do this, I'm using a preceding load:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Merge (LastPatUpdate) on PatKey Concatenate(Patient_Staging)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Load&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If(Exists(PatKey), 'U', 'I') As Operation,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;*;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Load&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;MVZKUERZEL &amp;amp; '_' &amp;amp; PATNR As PatKey,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;PATNR,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;GEBDATUM As Geburtsdatum,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If(GESCHLECHT = 'männlich' or GESCHLECHT = 'weiblich', GESC&lt;/STRONG&gt;HLECHT, 'Sonstiges') As Geschlecht,&lt;BR /&gt;&lt;STRONG&gt;PLZ As PatPLZ,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;MVZKUERZEL,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;UPDAT As LastPatUpdate&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;From ['$(file)']&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;(txt, codepage is 28591, embedded labels, delimiter is '|', msq);&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now if I run this, the record (even if the PatKey exists) is inserted every time and not updated with the new value. I think the problem comes from the preceding load as it has the same structure as the previously loaded table from my stored QVD - so the exist function will not lookup the old data but the first table of the preceding load.&lt;BR /&gt;&lt;BR /&gt;Is there any other way to deal with composite keys while using the merge command?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any helpful information!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 06:10:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Partial-Load-with-Merge-and-Composite-Key/m-p/2114814#M90987</guid>
      <dc:creator>alliedarmour</dc:creator>
      <dc:date>2023-09-08T06:10:52Z</dc:date>
    </item>
  </channel>
</rss>

