Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
GOKULAKANNAN
Creator
Creator

Data storing in QVD

 

My source is DB, where i will have all the record, if i have an item abc ,in which modified date as today, and tomorrow if its modified then new record will get created, but it wont replace the older one...so for an item we will have 2 records and while loading the data in qvd we need to get the latest one...but during the load the old record has already has been updated in qvd. How can i replace that with the new one.

 

Thank you

 

 

How can i acheive that?

3 Replies
stevejoyce
Specialist II
Specialist II

Take a look at incremental loading examples.

Loading new and updated records with incremental load ‒ Qlik Sense on Windows

 

This is a case of updated data.

 

You load your new/modified data first, but should only concatenate from qvd, where your key does not exist.  

 

QV_Table:

SQL SELECT PrimaryKey, X, Y FROM DB_TABLE

WHERE ModificationTime >= #$(LastExecTime)#;

 

Concatenate LOAD PrimaryKey, X, Y FROM File.QVD

WHERE NOT Exists(PrimaryKey);

 

STORE QV_Table INTO File.QVD;

GOKULAKANNAN
Creator
Creator
Author

Hi ,

 

thanks for the reply,

for example:

I'm having 4 rows of data like below

ItemcountryModified date
1234India27-07-2020
3456Canada28-07-2020
5676USA30-07-2020
7890Canada01-08-2020

 

on first reload the above data will be saved in qvd. now the update will be like addition of 2 rows within that one is a new record another one is as same as old record but only modified date will get change(last row)

 

ItemcountryModified date
1234India27-07-2020
3456Canada28-07-2020
5676USA30-07-2020
7890Canada01-08-2020
9876Sweden01-09-2020
1234India28-07-2020

 

Now in the last row the record is same , only change is modified date, in this case if we do concatenate it will add all the rows and it will save it in qvd, but I want to delete the existing record and add the new record and save it in qvd. how can I achieve this?

stevejoyce
Specialist II
Specialist II

 

//load data

data:

load *
from data_source
;

//limit to just current row for each item id

inner join (data)
load

Item,max([Modified date]) as [Modified date]
resident data
group by Item;