Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Date Variable in Where clause in load script

Dear All,

I need to put a where clause in load script.

Example :

LET vCutoffDate = makedate(2013);

LOAD [Invoice Date], [Standard Invoice Qty], [Invoice Amount], [Cost Value], [Invoice #]

FROM

Sales.QVD (qvd) WHERE [Invoice Date] >= vCutoffDate ;

How to achieve this ? Your help is badly needed.

Note : I do not want to change the SQL which is used to get data from DB using Select statement.

Regards,

Sahas

1 Solution

Accepted Solutions

Re: Date Variable in Where clause in load script

Sales.QVD (qvd) WHERE [Invoice Date] >= '$(vCutoffDate)' ;

4 Replies
jason_michaelid
Honored Contributor II

Re: Date Variable in Where clause in load script

Hi Sahas,

I think you're pretty much there, you just need dollar-expansion around the variable:

LET vCutoffDate = makedate(2013,10,30);

LOAD [Invoice Date], [Standard Invoice Qty], [Invoice Amount], [Cost Value], [Invoice #]

FROM

Sales.QVD (qvd) WHERE [Invoice Date] >= '$(vCutoffDate)' ;

However, using the WHERE clause here will break the optimised QVD load.  You may want to think about pre-loading all possible dates greater than your variable, then using WHERE EXISTS([Invoice Date]) to keep the load optimised.

Hope this helps,

Jason

Re: Date Variable in Where clause in load script

Sales.QVD (qvd) WHERE [Invoice Date] >= '$(vCutoffDate)' ;

Not applicable

Re: Date Variable in Where clause in load script

hi

try this in load

WHERE [Invoice Date] >= $(vCutoffDate);

Not applicable

Re: Date Variable in Where clause in load script

Dear All,

Thanks for your quick reply.

Community Browser