Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
alliedarmour
Contributor III
Contributor III

Partial Load with Merge and Composite Key

Hey folks,

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).

Now there are limited resources to get information from so I'm hoping to get an answer here.  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.

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:

Merge (LastPatUpdate) on PatKey Concatenate(Patient_Staging)

Load 
If(Exists(PatKey), 'U', 'I') As Operation,
*;
Load
MVZKUERZEL & '_' & PATNR As PatKey,
PATNR,
GEBDATUM As Geburtsdatum,
If(GESCHLECHT = 'männlich' or GESCHLECHT = 'weiblich', GESCHLECHT, 'Sonstiges') As Geschlecht,
PLZ As PatPLZ,
MVZKUERZEL,
UPDAT As LastPatUpdate
From ['$(file)']
(txt, codepage is 28591, embedded labels, delimiter is '|', msq); 

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.

Is there any other way to deal with composite keys while using the merge command? 

Thanks for any helpful information!

Labels (1)
0 Replies