Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

overlapping records

Hi,

I have some files with data from different periods and I have to load them into 1 QVW.

My problem is that there is some overlapping data in my files (the last records of the previous file are the same of the first records of the next file).

Now i need to find a method to not load these records again and prevent getting double data in my QVW.

The best thing would be to have only one load statement, because all my files have the same name, but with a different timestamp at the end of the filename, so i can load from filename*.csv

Because in the future there will be more files added, and when i use the wildcard in the filename I wouldn't have to edit my script all the time.

Thanks in advance!

1 Solution

Accepted Solutions
tresesco
MVP
MVP

you can try with DISTINCT load OR an NOT Exists() in the where clause.

Regards, tresesco

View solution in original post

4 Replies
tresesco
MVP
MVP

you can try with DISTINCT load OR an NOT Exists() in the where clause.

Regards, tresesco

Not applicable
Author

Hi,

If you have a KeyField you can try something like that :

for each File in filelist ('*.csv')

LOAD *
FROM $(File)
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
WHERE NOT EXISTS(KeyField);

next

Not applicable
Author

Hi,

Other method is also to write out to a QVD the max record (e.g. max(KeyField)) from the original load, then in the 2nd load, load this value into a variable (e.g. vLastLoadedRec) and restrict the load with a where clause such as where KeyField > $(vLastLoadedRec).

Renaud's technique is also BP.

Not applicable
Author

I agree, a LOAD DISTINCT would surely be the best way to handle this