COGNOiSe.com - The IBM Cognos Community

Planning & Consolidation => COGNOS Planning => Topic started by: LeeNash on 04 Apr 2013 03:57:39 AM

Title: Month extraction from Date
Post by: LeeNash on 04 Apr 2013 03:57:39 AM
Hi,

In Cognos Analyst I've been tasked with using an input field as a full date i.e. dd/mm/yy and then have another field which states the month only which looks at the full date.
Reason for this is the time dlist is a list of months i.e. Oct, Nov, Dec and we want to have the month which is pulled out to be dlist formatted. (Sorry if the terminology is incorrect here I've been working with Analyst for about a week now)

Ie. Full Date 01/10/13
     Month     OCT

I cant seem to find a way to take out the month as a value or dice up the full date and extract the month.

Does anyone know a good way of doing this?

Thanks
Title: Re: Month extraction from Date
Post by: mr j on 04 Apr 2013 05:23:14 AM
Hi!

Not that I understand exactly why you want to do what you want to do   ;)    and since it was not your question let's leave that for now...

I quickly tested by creating a D-List of two items, hope you understand the syntax in the following:
- Item "Full date" with format "Date: DD/MM/YY"
- Item "Month" with format "Date: Mon YY" and calculation "= {Full date}"

The formats are what there's available in version 8.4.1, ie. no option "Mon" only, but it gets you pretty close. I know, unfortunately that's not always enough.

To get rid of the "YY" I used another format e.g. "DD-Mon-YY" and then D-Cube export to file. Then create a file map from this and create a subcolumn with the "Mon" part only to use as data, skip the other columns.

Now create your time D-List and in the import options select "Text file" and now comes the strange part... select the file you exported first. AFTER THIS you get the option to "Select how to interpret ASCII file" with options to use delimiter or a map. Choose "Use map" and then the map you created earlier.

There's possibly some better solutions, but this was the first that occurred to me right now and wanted to take part in this as there's possibly a need for something similar in the near future... I also edited this reply a couple of times so there's probably confusion in the minds of those who read the earlier ones   :D  Sorry folks..
Title: Re: Month extraction from Date
Post by: LeeNash on 04 Apr 2013 07:33:46 AM
ah ok so you've basically created a seperate dlist as a lookup then?
I think I understand

Thanks alot.

Lee
Title: Re: Month extraction from Date
Post by: mr j on 04 Apr 2013 07:43:43 AM
Well, that's what I ended up doing there, but I'm not quite sure if that's what you wanted   :)

Anyhow I guess the idea to extract the month from the date can be applied to whichever your purposes.