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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load, join, WHERE

Hi,
I need to LOAD new records ONLY:
WHERE TimeStamp>= vUpdateDate
However, since I first have to make a join in order to get the TimeStamp and complete my table I cannot use a regular WHERE statement, or can I?
Any ideas how to work around this? Can I create a "Final Table" including the TimeStamp and then use a WHERE statement?
Im lost
Thanks in advance,
Olle 
NoConcatenate
LOAD CCY,
           ACC,
          
BIC,
           ValueDate
FROM $(vSourceData)*.xls
(
biff, embedded labels, header is 3 lines, table is @1)
WHERE Len(currency)=3;
DateTimeInfo:
LOAD
    
Timestamp#((DATE(@1, 'MM/DD/YYYY')&' '&TIME(@2, 'hh:mm:ss')),'DD/MM/YYYY hh:mm:ss') As TimeStamp
FROM $(vSourceData)*.xls
(
biff, no labels, header is 1 lines, table is @1) Where RecNo() < 2;
JOIN(Incremental)
LOAD * RESIDENT DateTimeInfo;
DROP TABLE DateTimeInfo;





1 Solution

Accepted Solutions
simondachstr
Specialist III
Specialist III

Apologies for the late reply!

See attached. There were a couple of syntax errors (always end your trace statement with a ; ). I've tested the script by creating a new Report4.xls and changing the date to T+1 and the incremental load worked. Make sure you change your vSourceData and vSaveQVD variables back to your File-Path as I've modifed them in the script.

Let me know if it works okay for you.

View solution in original post

14 Replies
simondachstr
Specialist III
Specialist III

I'm missing the following in your code:

  • Declaration of vUpdateDate
  • Where is the Incremental table?

Theoretically you should be able to do a final resident loada using a where statement. Something like:

LOAD *

Resident Incremental

WHERE TimeStamp >= '$(vUpdateDate)'

amit_saini
Master III
Master III

Olle,

Check if this helps u:

only want to load new records only...

Thanks,
AS

amit_saini
Master III
Master III

Also incremental load will help here:

Incremental Load

Thanks,

AS

alkesh_sharma
Creator III
Creator III

Load the incremental data and store it into a new qvd.

Load the new qvd into a test file and check the data is pulled as per your requirement.

Concatenate the new pulled data into the old qvd.

Not applicable
Author

Hi Martin,

sorry, should be as per below:

Kind Regards,

Olle

// ----QVD LOAD---- //

LOAD
   
CCY,
   
ACC,
   
BIC,
   
ValueDate,
    REF
FROM
$(vSaveQVD)final.qvd
(
qvd);

Table2:
LOAD *
Resident Table1
Order By TimeStamp;
LET vUpdateDate = Peek('TimeStamp', -1, 'Table2');
Drop Table Table1;

//---- INCREMENTAL LOAD ----//

Incremental:

NoConcatenate
LOAD CCY,
          ACC,
         
BIC,
          ValueDate,
          REF

FROM $(vSourceData)*.xls
(
biff, embedded labels, header is 3 lines, table is @1)
WHERE Len(currency)=3;

DateTimeInfo:
LOAD
   
Timestamp#((DATE(@1, 'MM/DD/YYYY')&' '&TIME(@2, 'hh:mm:ss')),'DD/MM/YYYY hh:mm:ss') As TimeStamp
FROM $(vSourceData)*.xls
(
biff, no labels, header is 1 lines, table is @1) Where RecNo() < 2;

JOIN(Incremental)
LOAD * RESIDENT DateTimeInfo;
DROP TABLE DateTimeInfo;

//-- UPDATE MAIN QVD --//

Concatenate
LOAD
   
CCY,
   
ACC,
   
BIC,
   
ValueDate
FROM
$(vSaveQVD)SEBIS.qvd
(
qvd)
WHERE NOT Exists(REF);
STORE Incremental into $(vSaveQvd)final.qvd(qvd);
Drop Table Incremental;





simondachstr
Specialist III
Specialist III

First of all be aware of the not exists issue and check if it applies to you.

http://community.qlik.com/docs/DOC-7020

Secondly try adding the following code before updating the main qvd

Final_Incremental

LOAD *

Resident Incremental

WHERE TimeStamp >= '$(vUpdateDate)'

Drop Tables Incremental;

Not applicable
Author

Hi Martin,

thanks for the reading tips! I think the exists function will work in my case.

So I added the "Final_Incremental" table into the Incremental Load section and replaced "Incremental" with "Final_Incremental" in the MAIN QVD UPDATE section. Please see script.

However, receiving below error message:

Table not found

STORE Final_Incremental into final.qvd(qvd)

Any ideas?

Kind Regards,

Olle


//---- INCREMENTAL LOAD ----//

Incremental:

NoConcatenate
LOAD CCY,
          ACC,
         
BIC,
          ValueDate,
          REF

FROM $(vSourceData)*.xls
(
biff, embedded labels, header is 3 lines, table is @1)
WHERE Len(currency)=3;

DateTimeInfo:
LOAD
   
Timestamp#((DATE(@1, 'MM/DD/YYYY')&' '&TIME(@2, 'hh:mm:ss')),'DD/MM/YYYY hh:mm:ss') As TimeStamp
FROM $(vSourceData)*.xls
(
biff, no labels, header is 1 lines, table is @1) Where RecNo() < 2;

JOIN(Incremental)
LOAD * RESIDENT DateTimeInfo;
DROP TABLE DateTimeInfo;


Final_Incremental:

LOAD *
Resident Incremental
WHERE TimeStamp >= '$(vUpdateDate)';
Drop Table Incremental;

//-- UPDATE MAIN QVD --//

Concatenate
LOAD
   
CCY,
   
ACC,
   
BIC,
   
ValueDate
FROM
$(vSaveQVD)SEBIS.qvd
(
qvd)
WHERE NOT Exists(REF);
STORE Final_Incremental into $(vSaveQvd)final.qvd(qvd);
Drop Table Final_Incremental;

simondachstr
Specialist III
Specialist III

Sorry - that's my mystake.

Add a NoConcatenate statement before loading the Final_Incremental table

Not applicable
Author

No more error messages,

however the join does not seem to work (no TimeStamp field in the app) and getting synthetical keys on every field.
A tricky one!