Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 🙂
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')
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.
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.
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')
Thank you! Will check this when I will return to work and update.
Thank you, it works 🙂