Discussion Board for collaboration on QlikView Scripting.
I have to filter only for Current 10 weeks data while loading without hard-coding it, but am not aware how would i do that in script level.
looking forward for your help.
Thanks & Regards,
Probably the best way would be to do it on database level. Which DBMS are you using? Please post your load statement
Are you looking for the last 10 weeks (i.e. 70days) or the 10 weeks from last Sunday?
But you can use today() functionality against your dates and/or weeks in your load script. For example;
where today()>= [yourdate] and today()<=[yourdate];
How does this help? Let me know how you get on.
Sorry - slight amendment to what I wrote above;
where [yourdate] + 70 >= today();
Something like this:
LET vStart = num(today())-70;
SQL select * from mysource
where MyDate > $(vStart) ;
You may need to format the start date parameter value to the date format your database expects.
LET vMaxDate = Num('31/12/2013');LET vMinDate = Num('01/01/2013');tCal: LOAD
$(vMinDate) + RowNo() - 1 As Date, Date($(vMinDate) + RowNo() - 1) As FormalDate,
AutoGenerate ($(vMaxDate) - $(vMinDate) + 1); Cal:NoConcatenate
Resident tCalWhere Date >= ($(vMaxDate) - (10*7) + 1);
DROP Table tCal;