Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
MalcolmCICWF
Creator III
Creator III

Deduping Records?

I am using the below code to load record counts from QVDs and track them. However, when I am making changes and doing multiple reloads a day, I get multiple records of the reload for the same day. I have incremental reloads of other QVDs that only keep the most recent reload record and I would like to do something similar for this code.

So the question is, "How do I keep only the most recent reload when I refresh this QVD multiple times a day"? Do I have to set some sort of system date variable and then some how concatenate only the most recent reload?

Capture.JPG

5 Replies
Miguel_Angel_Baeyens

Hi,

As long as you are concatenating the existing QVD, and storing it into the same QVD file, it will actually save and load each time you perform a reload. If I understand correctly you only want to keep one row per date, with the latest reload as the only row for that date, then I'd do something like the following:

Size:

LOAD ...

AUTOGENERATE 1;

CONCATENATE LOAD

...

FROM QVD_Size.qvd (qvd)

WHERE Date(ReloadTime) <> Today();

STORE Size INTO QVD_Size.qvd (qvd);

This will always load the current values, but will not load the same day line, if any, in the concatenated table, so you always have only one value per day.

Hope that helps.

Miguel

MalcolmCICWF
Creator III
Creator III
Author

I added in the  "WHERE Date(ReloadTime) <> Today();" script and it is still loading multiple reload dates for my report. Since it says <> Today(), every reload is greater than the last because there is time stamps yet... Any ideas?

I jsut need to have one set of records per day kept from teh LAST time the report was reloaded.

vinieme12
Champion III
Champion III

Use the concept of incremental load and check where not exist reloadDATE(not time; just date)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

Example

LEt reloaddate = NUM(TODAY());

Size: 

LOAD ...,

'$(reloaddate)' as ReloadDate

AUTOGENERATE 1; 

 

CONCATENATE LOAD 

... 

FROM QVD_Size.qvd (qvd) 

WHERE not exist (ReloadDate); 

 

STORE Size INTO QVD_Size.qvd (qvd);

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

if your problem has been resolved can you close this thread?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.