Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
samvile18
Creator III
Creator III

Script Syntax issue

Morning fellow Qlikers,

I'm trying to load some data directly from my MSAccess DB - I'd like to only load the data that falls in between two dates, I have the following in the where clause but it keeps crashing and I'm not sure why:

WHERE CRDATE >= '01/02/2013' AND <='28/02/2013' AND RIGHT(INXFLD01,1)='F';

Can anyone help me understand where I'm going wrong please?

9 Replies
sivarajs
Specialist II
Specialist II

WHERE CRDATE >= '01/02/2013' AND CRDATE<='28/02/2013' AND RIGHT(INXFLD01,1)='F';

manideep78
Partner - Specialist
Partner - Specialist

Here for comparing date two times, you should write field name two times. Otherwise it will give syntax error.

WHERE CRDATE >= '01/02/2013' AND CRDATE<='28/02/2013' AND RIGHT(INXFLD01,1)='F';

samvile18
Creator III
Creator III
Author

Sorry about that chaps, looks like it didn't paste in properly...in my script I HAVE named the field twice and it's still not working.

sivarajs
Specialist II
Specialist II

Could you  find where exactly you are getting error?

samvile18
Creator III
Creator III
Author

This is the error it's returning:

QV Error.JPG

sivarajs
Specialist II
Specialist II

This might due to if date is not in a valid range.Please check you have value within the range that you have specified and also the timestamp format

Not applicable

WHERE CRDATE >= DATE('01/02/2013','DD/MM/YYYY')

AND CRDATE<= DATE('28/02/2013','DD/MM/YYYY')

AND RIGHT(INXFLD01,1)='F';

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

It looks like the Access database has dates in a format different to what you are using (probably M/D/Y format). Comparing a date field to a string requires the string to be converted into a date and the conversion will attempt to use the date format used in the database (or the default date format for the PC set in the control panel)

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
samvile18
Creator III
Creator III
Author

Thanks for all the help everyone, I'm still having odd issues though.

Even though te query is now pulling data back, it seems to be ignoring the criteria and bringing back everything for the year?!!

Any ideas?