If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Date format conversion

Started by oscarca, 21 Sep 2018 02:49:38 AM

Previous topic - Next topic

oscarca

Hey Cognos people,

Is it possible to convert integer 20180501 to this format 2018/May and if so how ?

What I have done so far is:
Created 4 data items
[Date]:cast([Verksamhet].[Order Stock].[Faktiskt Leveransdatum];date)

[Month] : case
extract(month;[date])
when 1 then 'January'
when 2 then 'February'
when 3 then 'March'
when 4 then 'April'
when 5 then 'May'
when 6 then 'June'
when 7 then 'July'
when 8 then 'August'
when 9 then 'September'
when 10 then 'October'
when 11 then 'November'
when 12 then 'December'
else 'error'
end

[Year]: extract(year;[date])

[Year/Month]: [Year] || '/' || [Month]

But then getting error:
The operation "add" is invalid for the following combination of data types: "integer" and "character"


Many thanks,
//Oscar

oscarca

This was actually easier than I thought.. Manage to do it just by setting date pattern to yyyy/MMM after I had converted the int to date which gives me 2017/may