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

Month function in Script

Hi:

Full disclosure I'm not a QV developer, just playing one on TV.

Trying to load several fields from and Oracle DB and in the process create a new Month and Year field based upon a timestamp field that is coming in.

Currently have:

DETL: 

SQL SELECT

ID,

CREATE_DATE,

MONTH (CREATE_DATE) as CREATEMONTH;

And get:

ErrorSource: OraOLEDB, ErrorMsg: ORA-00904: "MONTH": invalid identifier

Can I do this or am I just doing somethign stupid?

Thanks in advance,

Jim

Tags (2)
1 Solution

Accepted Solutions
Employee
Employee

Re: Month function in Script

In principle you should be able to do this, but it is better if you use a preceding load:

Load

ID,

CREATE_DATE,

MONTH (CREATE_DATE) as CREATEMONTH;

SQL SELECT * FROM ...

HIC

4 Replies
Employee
Employee

Re: Month function in Script

In principle you should be able to do this, but it is better if you use a preceding load:

Load

ID,

CREATE_DATE,

MONTH (CREATE_DATE) as CREATEMONTH;

SQL SELECT * FROM ...

HIC

Not applicable

Re: Month function in Script

This worked perfectly. Thanks for the quick reply.

Re: Month function in Script

Hi,

You can use To_Char function too

To_Char(Date_Field,'MM') = 01

To_Char(Date_Field,'MON') = JAN

To_Char(Date_Field,'YY') = 03

To_Char(Date_Field,'YYYY') = 2003

Also you can go with preceding load as suggested by Henric Cronström.

Not applicable

Re: Month function in Script

Sorry, Gysbert, accidentally deleted your post but it did work as well. All great options.

Community Browser