COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Topic started by: pali on 27 Jan 2006 12:41:44 AM

Title: [Solved]Need only month and year in prompt
Post by: pali on 27 Jan 2006 12:41:44 AM
hi all
In a report i just want user to select a month and year.
So please guide me to create a prompt page in which user can select a month name from a value prompt and a year from different prompt.
Is there any other way through which i can achieve it.
thanks in advance.Ã, 
Title: Re: Need only month and year in prompt
Post by: JoeBass on 27 Jan 2006 07:12:56 AM
You could create a lookup table to query values to fill your Month and Year prompts or create static choices.
Title: Re: Need only month and year in prompt
Post by: pali on 27 Jan 2006 08:09:55 AM
hi
thanks for reply.
Its ok that i can take collection for month but for year creating a collection is not vailable as the value of year can be from very long range.

Title: Re: Need only month and year in prompt
Post by: bdybldr on 27 Jan 2006 10:41:27 AM
pali, try this..

create a new query (ie. DatePrompt) with two data items.
1) month - defined as "extract(month, [date])"Ã, 
2) year - defined as "extract(year, [date])"

Then add to value prompts to your prompt page.Ã,  For example, month prompt.
Set the query for the prompt to "DatePrompt"
Set the "use value" and "display value" to [month]
Set the parameter value to "parmMonth"

Do the same for the year prompt.

Then, create your filter as...

extract(month, [date]) = ?parmMonth? and extract(year, [date]) = ?parmYear?

Hope this helps...let me know if you have any questions.
Title: Re: Need only month and year in prompt
Post by: pali on 28 Jan 2006 03:53:18 AM
thanks for reply.
its working and i got another solution also by using java script for the prompt page and to set values in value prompt using script only.
Title: Re: [Solved]Need only month and year in prompt
Post by: bdybldr on 30 Jan 2006 02:57:03 PM
Pali, please provide the details of your solution so everyone can learn from it.  Thanks.
Title: Re: [Solved]Need only month and year in prompt
Post by: pali on 31 Jan 2006 03:43:19 AM
This was the script that i used for my report ,SO i can't copy report xml but i am attching script so for that u need to create two value prompt in prompt page.And then use this java script code in HTML item.
Title: Re: [Solved]Need only month and year in prompt
Post by: bdybldr on 31 Jan 2006 07:35:28 AM
Pali, thanks for the solution...very helpful.

One suggestion, it's spelled "February" not "Fabuary".  I'm sure someone will eventually bring that to your attention.

Thanks again.