Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
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
MK_QSL
MVP
MVP

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

View solution in original post

4 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

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

MK_QSL
MVP
MVP

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

Not applicable
Author

hi

try this in load

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

Not applicable
Author

Dear All,

Thanks for your quick reply.