Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello community,
I need a clarification on while loading the data from QVD into qlikview application
a QVD, which consists years of data (2006 - 2012)
While loading the data into qlikview from QVD,here my requirement is load only 3years of data which is from 2010 to 2012 instead of loading all the data from QVD.
In this scenario how can I accomplish my requirement dynamically?
Plz help me out in this.
You can use the * as a wildcard to load multiple QVD's at once. Ex: OrderData*.qvd will load OrderData2014 and OrderData2015 at the same time.
Load * from <qvdpath>*.qvd(qvd))
Simply add a WHERE clause at the end of the LOAD
WHERE(YEAR >= '2010' AND YEAR <= '2012' );
if 2010 and 2012 is dynamically decided during load you can use variables instead of literals
You can load the max(year) from the QVD before it is actually loaded to be able to dynamically pull your data.
MaxYear:
LOAD
max(year) as Year
from myQvd.qvd;
LET vMaxYear = Peek('Year',-1,'MaxYear');
Drop Table MaxYear;
Use that variable then to calculate your rolling years.
Could you please elaborate this again???
// test data in qvd (2006-2012)
//
DIRECTORY;
for i=2006 to 2012
aaaa:
load $(i) as year , rowno() as id AutoGenerate 100;
NEXT;
store aaaa into aaaa.qvd (qvd);
DROP Table aaaa;
// get max year from qvd file and load
//
t: LOAD max(year) as MaxYear from aaaa.qvd (qvd);
let vMaxYear=Peek('MaxYear')-2;
final: load * from aaaa.qvd (qvd) where year >= $(vMaxYear);
DROP Table t;
Loading the max year will give you a way to work dynamically. If your max year keeps going up, you'll need to adjust based upon that. So say max year is 2012 and you need to go back to 2010 you can say $(vMaxYear) - 2 to give you 2010. So coding this like Erdal did above, you'd want to use this:
WHERE(YEAR >= '$(vMaxYear)-2' AND YEAR <= '$(vMaxYear)' );
thanks for reply
I need one more clarification
To read single qvd into qlikview from the qvd source path(Load * from <qvdpath><qvdname>.qvd(qvd))
But how to read multiple qvds at a time, is it possible???
Pls suggest!!!
You can use the * as a wildcard to load multiple QVD's at once. Ex: OrderData*.qvd will load OrderData2014 and OrderData2015 at the same time.
Load * from <qvdpath>*.qvd(qvd))