Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello smart people,
I'm trying to use a variable in a load statement that pulls data from a QVD. Unfortunalety it is not going as I'd hoped. Perhaps someone can help?
Let vMinDate = '3/1/2014';
MY_TABLE:
LOAD MY_ID,
CLOSE_DATE,
IF(CLOSE_DATE>=$(vMinDate),1,0) AS TBLBOX_FILTER
FROM
[$(vQVDFilePath)\MY_TABLE.QVD](qvd);
When I run this, all values in TBLBOX_FILTER end up as 1, regardless of CLOSE_DATE. There should be some records with 0, as there is data with a CLOSE_DATE prior to 3/1/2014.
If I change the IF statement to have a hard-coded date:
IF(CLOSE_DATE>='3/1/2014',1,0) AS TBLBOX_FILTER
It works the way I want it - some records have 0 and some have 1.
Any idea as to why it using the variable doesn't function properly?
Thanks,
Brent
try adding quotes to you variables IF(CLOSE_DATE>='$(vMinDate)',1,0)
try adding quotes to you variables IF(CLOSE_DATE>='$(vMinDate)',1,0)
That did it. It seems a little strange. You would think that if it were surrounded by single quotes it would think the text between was literal and not a variable.
Thank you for you help and quick response!