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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Jenny
Contributor II
Contributor II

Incremental load by latest date

Hi,

 

I have a QVD file with January 2025 data. 
Which means my file has column with relevance_date set to : 1/1/2025

Now, I try to preform Incremental load from SQL for 1/2/2025 data.
Checking in forums I tried to load the latest date from my QVD file into variable by using Peek() and then filter the relevance_date like so:

 

load *;

odbc conection…

Sql

select * from DB_table

where relevance_date > $(vLatestQvdDate)

 

This doesnt work because for some reason the variable doesn’t store any value in it and returns empty value like this : ‘’

Checks I performed:

1) peek() show the correct value in model viewer

2) if I set the date manually like so:

let vLatestQvdDate = 1250201 (this is teradata format)

it works fine

3) Only when I use qlik functions for defining a variable this doesn’t work.

its really weird to me because there has to be a way in which you can filter relevant results from Sql DB. 


qlik sense documentation also shows that you can filter by qlik variable in sql. You can check the documentation for “Incremental load” in qlik web.

Helpppp. Thank you 🙂

Labels (5)
1 Solution

Accepted Solutions
henrikalmen
Specialist II
Specialist II

Field names within peek() must be specified as a string. So you need apostrophes: peek('LastDate', 0)

Sometimes it also helps to specify the table where peek should look (also surrounded by apostrophes): peek('LastDate', 0, 'thetablename')

View solution in original post

5 Replies
henrikalmen
Specialist II
Specialist II

How do you try to assign the value to the variable; what does that look like in your script? Apparently you are not successful there, since you say yourself that the variable is empty.

Jenny
Contributor II
Contributor II
Author

Hi,

like so:

 

load date(max(relevance_date), ‘1YYMMDD’) as LastDate from [lib://folder/Table.qvd](qvd);

let vLatestQvdDate = peek(LastDate, 0);

 

I can see the variable shown correctly in data model. It is just when I assign it to the sql query that is when it is empty.

henrikalmen
Specialist II
Specialist II

Field names within peek() must be specified as a string. So you need apostrophes: peek('LastDate', 0)

Sometimes it also helps to specify the table where peek should look (also surrounded by apostrophes): peek('LastDate', 0, 'thetablename')

Jenny
Contributor II
Contributor II
Author

Thank you! Will check this when I will return to work and update. 

Jenny
Contributor II
Contributor II
Author

Thank you, it works 🙂