Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Need your help in script

Dear All,

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,

Venkat T

5 Replies
Not applicable

Re: Need your help in script

Hi Venkat

Probably the best way would be to do it on database level. Which DBMS are you using? Please post your load statement

Lukasz

Not applicable

Re: Need your help in script

Hi

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;

Load

     *

From [FILE]

where today()>= [yourdate] and today()<=[yourdate];

How does this help?  Let me know how you get on.


Steve

Not applicable

Re: Need your help in script

Sorry - slight amendment to what I wrote above;

Load

     *

From [FILE]

where [yourdate] + 70 >= today();

Re: Need your help in script

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.


talk is cheap, supply exceeds demand
senpradip007
Valued Contributor III

Re: Need your help in script

Try this:

 

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

LOAD

          Date,
          FormalDate

Resident tCal
Where Date >= ($(vMaxDate) - (10*7) + 1);

DROP Table tCal;

Community Browser