Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Year changes into a numeric field during extraction

Hi all,

i'm connecting to an oracle database.

The years im extracting (eg. 2007, 2008, 2009) are into a column with num(20,0). So no decimals,

Im extracting through an OLE DB connection.

When I get output, the years are represented as a number (eg 2007,00; 2008,00;2009,00).

Is there a setting in the connection or something to let the values just 2007 etc?

Thanks in advance.

KR

Reyman

4 Replies
jason_michaelid
Honored Contributor II

Year changes into a numeric field during extraction

Try any of the following in your load script:

Num(year,'0')     AS     Year

Floor(Year)        AS     Year

Round(Year)      AS     Year

Hopefully one or more of these should work!

Jason

Not applicable

Year changes into a numeric field during extraction

Normally if it should be 2007.00 and i wanted it to be 2007, I should use num yes.

But now it is 2007 in the database datetype in oracle but in oracle 11 it is internally stored as a timestamp.

I don't want to use and function, but just want that QV reads, hey its a date type, so i need to extract it as a date, not as a timestamp.

jason_michaelid
Honored Contributor II

Year changes into a numeric field during extraction

The time portion of a timestamp is the decimal part of the number so Floor(Timestamp) will get you just the date part.  Date(Floor(Timestamp),'DD/MM/YYYY'), for example.

If you really don't want to use a function like this you could try changing the SET section at the top of the script:

SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';

to

SET TimestampFormat='DD/MM/YYYY';

Maybe that'll work.

Jason

jason_michaelid
Honored Contributor II

Year changes into a numeric field during extraction

Did you get this working?

Community Browser