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: 
BlakeGri2093
Contributor III
Contributor III

Incremental Load With Timestamp

Hi Qlik Sense Expert

 

I doing incremental load with qvd file with the sql database. I followed some below step

First: Create max date and pass it into variable 

Second: using where condition greater than the variable. But it not working, by the way my date file is timestamp

This is my script to deploy incremental load

Fact:
date(Max(Timestamp(orderdate),'DD-MM-YYYY'))) as Maxdate

From [lib://DATA_ETL_LAYER/1. DATA/Sales.qvd];

let Vmaxdate = peek('Maxdate',0,Fact);

LIB CONNECT TO 'Microsoft_SQL_Server_BISVR';

Sql Select * 

From Bi.Dbo."Sales" where to_date(to_char(orderdate),'DD-MM-YYYY'),'DD-MM'-YYYY') > todate('$(Vmaxdate)','DD-MM-YYYY')

concatenate

Load *

From [lib://DATA_ETL_LAYER/1. DATA/Sales.qvd];

But when i load the data, it seems qlik sense does not recognize the to char function. Could you guys help me with that ? 

 

 

Labels (1)
2 Replies
lfetensini
Partner - Creator II
Partner - Creator II

The problem is to_date in your variable. Anyway force Dates to Number to do simple:

 

Fact:
Num(Date#(Max(orderdate),'DD-MM-YYYY')) as Maxdate

From [lib://DATA_ETL_LAYER/1. DATA/Sales.qvd];

let Vmaxdate = peek('Maxdate',0,Fact);

 

Change:

From Bi.Dbo."Sales" where to_date(to_char(orderdate),'DD-MM-YYYY'),'DD-MM'-YYYY') > todate('$(Vmaxdate)','DD-MM-YYYY')

 

To:

From Bi.Dbo."Sales" where to_number(to_char(orderdate),'DD-MM-YYYY')) > $(Vmaxdate)

Support your colleagues. Remember to "like" the answers that are helpful to you and flag as "solved" the one that helped you solve. Cheers.
BlakeGri2093
Contributor III
Contributor III
Author

Your solution still have the same error like i do above. So does anyone help me with that, i using cast function in sql to convert timestamp to numeric but the result is wrong ( always missing one day ).