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

text box prompt, current year for default value

Started by philelmousse, 22 Mar 2012 10:03:42 AM

Previous topic - Next topic

philelmousse

Hello,

I have a text box prompt to fill with the year. It's possible to set the default value with the current year ?

Thanks

Grim

Javascript version:
http://www-01.ibm.com/support/docview.wss?uid=swg21342970

Other solution from devworks forum:
http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14679605
Quotecreate one data item
and write coding like
case when cast(extract(year,yourdataitem),varchar(4))=cast(extract(year,{sysdate}),varchar(4))
then '0'
else '-1'
end
the above code whenever the date equals to system date will give you 0
and other date give as -1

now in the "Date Value Prompt" in properties
Use Value:the above data item
Display Value:your date data item
Default Selection:0

now you run the report it will always give you current year.
"Honorary Master of IBM Links"- MFGF
Certified IBM C8 & C10 Admin, Gamer, Geek and all around nice guy.
<-Applaud if my rant helped! 8)

philelmousse

Thanks.

I created that data item :

CASE
WHEN cast([REPORTING LAYER].[Calendar Time].[Calendar Time].[Year].[year],varchar(4))=cast(extract(year,current_date),varchar(4))
then '0'
else '-1'
end


It returns

CurrentMonth CurrentYear year
5 -1 2009
5 -1 2010
5 -1 2011
5  0 2012

So it seems to work but when I run the report the default year is 2011

In the value prompt for useValue I selected that data item, for the display value i selected [REPORTING LAYER].[Calendar Time].[Calendar Time].[Year].[year] and for the default '0'... That is weird

philelmousse


philelmousse

But the issue is that the used value will be 0 and I need the year and the month to filter the queries

philelmousse

still the same issue because i need to create schedule for my reports every month. I need to find how dynamiclly fill my prompts for the current month and the current year

philelmousse

So i add a static choice with a use value ' ' and a display value 'current month'. But in framework manager i use a stored procedure with a month parameter. And i dont know how to pass something like that in the stored procedure : (?Month? = ' ' and [DATABASE LAYER].[calendar_time].[month] = extract ( month, current_date  ))) or ([DATABASE LAYER].[calendar_time].[month]  =?Month?)