Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Issues with selecting with date ranges?!

I am trying to make a select from an ODBC connection using this select:

SELECT TASK_ID, CANCELLED_DATE, CLOSED_TIME, CLOSED_DATE, DEADLINE_DATE, DEADLINE_TIME, DOCUMENT_TYPE, TASK_FAULT_CODE_ID, TASK_TYPE, X_OPEN

FROM REP_TASK_NF WHERE DEADLINE_DATE BETWEEN $(FromDate) AND $(ToDate);

$(FromDate) and $(ToDate) are both variables being used in a Calender Object.

Am i going the right way about this or is the not the best way of going about this?

Thanks

Tags (3)
2 Replies

Re: Issues with selecting with date ranges?!

That might or might not work. If your variables are numeric dates and DEADLINE_DATE also is a numeric date field it  should work. If not you need to make sure the dates have the same date format and you might need to use single quotes around the variable expansion: WHERE DEADLINE_DATE BETWEEN '$(FromDate)' AND '$(ToDate)'. It could even be that you need to use a function like to_date (for oracle) or convert (for sql server) to cast a string to a date.



talk is cheap, supply exceeds demand
Not applicable

Re: Issues with selecting with date ranges?!

I've tried putting the variables inside ' ' and that doesnt seem to let me select with both a FromDate and ToDate.

How to do I go about using the convert function?

Community Browser