Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Where Clause

I'm trying to use the Where Clause to only select the last two years but keep getting error message.

10 Replies

Re: Where Clause

HI

Qlikview is case sensitive.

SO, Please check year field..

YEAR or Year or year? And also is Year field available in db?

Not applicable

Re: Where Clause

Sorry the dummy question, but are you sure the year field in the where clause is exactly writen as existing in the db you are loading?

Not applicable

Re: Where Clause

the field is "DATESUBMITTOOPEN" and the Format is MM-DD-YYYY HH:MMSmiley FrustratedS AM but i want to select just the last two years. is this possible?

Re: Where Clause

HI

Try like this

Select * From tableName where Year(DATESUBMITTOOPEN) >= 2010 and Year(DATESUBMITTOOPEN) <= 2012;

Not applicable

Re: Where Clause

Sure it's possible, but you need to transform your data first in order to create a year reference.

you can try the following:

Select *

From YourTable

Where Year(DateSubMitToOpen)>=xxxx and Year(DateSubMitToOpen)<yyyy

The xxxx and yyyy are the year values you are using as the min and max timestamp values you want to load

If you need a more automated load script then some more steps are required

Regards

Not applicable

Re: Where Clause

Error1.JPG

Re: Where Clause

HI

Can you say, did u use any YEAR field or set in any variable in your script?

There is no error in the script, it work fine. Can you provide a script which you are using?

Not applicable

Re: Where Clause

Yes Year(DateSubMitToOpen) as DateSubMitToOpen

Re: Where Clause

HI

Its difficult to say without your script.

Try like this

Generally load all the data, like this

Load Year(DateField) as Year, FieldName1,FieldName2;

Select * from tableName where Year(DateField) >= 2010 and Year(DateField) <= 2012;

Community Browser