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

Current Year as default Year and same as Month also

Started by srinu_anu2007, 07 Feb 2014 03:28:07 AM

Previous topic - Next topic

srinu_anu2007

Hi,

I have year prompt and Month prompt and the values are fetching from Year prompt is 2008,2009.......2016 and Month as like Jan,Feb.......Nov,Dec. When you running the report it would show 2014 as current year and if u ran the report for next year it should show 2015 in year prompt and same as month also. I am using cube as source.

Any ideas?

Thanks,

srinu_anu2007

Hello MF/khayman

Any ideas on current year as default year and current month as default month? i believe it will work work from JS.

Thanks,

MFGF

I'm afraid the Muppet and Javascript are lifelong enemies - we really don't seem to get along. The following statement sums up my approach to javascript in reports...

"AAAAAAGGGHHHH!!!"

:)
Meep!

chinnucognos

Hi,

I have one approach which maynot suitable for ur requirement, but use that approach  to find further...
  for eg: take single value prompt for both Year and Month

then take data item as "year_month" & "current_year&month",

"current_year& month": (to_char(current_date, 'YYYY - Month'))
"year_month": case
when  ([AE_TRANSACTION_DATE1] = (to_char(current_date, 'YYYY - Month')) )
then 1
when ([DATE_coloumn1] = ( to_char(add_months(current_date,-1), 'YYYY - Month') ) )
then 2
when ([DATE_coloumn1] = ( to_char(add_months(current_date,-2),'YYYY - Month') ) )
then 3
when ([DATE_coloumn1] = ( to_char(add_months(current_date,-3),'YYYY - Month') ) )
then 4
when ([DATE_coloumn1] = ( to_char(add_months(current_date,-4),'YYYY - Month') ) )
...

.
.
.
when ([DATE_coloumn1] = ( to_char(add_months(current_date,-23),'YYYY - Month') ) )

then 24

end.



filters: 1.to_char([DATE_coloumn1]'YYYY - Month') <= [current_year&month]
           2.[year_month] < 25
Deal with it!

srinu_anu2007

Hi,

This logic was not working. Any ideas would be appreciated?

Thanks,

MFGF

Quote from: srinu_anu2007 on 14 Feb 2014 11:49:20 AM
Hi,

This logic was not working. Any ideas would be appreciated?

Thanks,

What does "This logic was not working" mean?

There have been a number of posters lately who add comments like "It doesn't work" or "it throws an error" and add nothing further. How is anyone supposed to know what this means? Although it would be nice to have the gift of clairvoyance and somehow know the exact details of how the logic doesn't work, I'm afraid the folks here on the forum are not blessed with this supernatural gift. This means you need to tell us how it doesn't work - details that describe the issue. Otherwise you may as well post "I have a problem, please tell me the answer" - it would be just as meaningless as "it doesn't work".

MF.
Meep!

srinu_anu2007

V5 syntax error found for data item 'year_month' of query 'Y&M', invalid token "." found after "case when ([Package Name].[year].[year] = (to_char(current_date, 'YYYY - Month')) ) then 1 when ([Package Name].[year].[year] = ( to_char(add_months(current_date,-1), 'YYYY - Month') ) ) then 2 when ([Package Name].[year].[year] = ( to_char(add_months(current_date,-2),'YYYY - Month') ) ) then 3 when ([Package Name].[year].[year] = ( to_char(add_months(current_date,-3),'YYYY - Month') ) ) then 4 end".

iam getting the above  error and hence may be my approach is also wrong. please let me know whether iam am following correct approach?

I have added two data items as per ur sggestions and added the above code. The filter filters: 1.to_char([DATE_coloumn1]'YYYY - Month') <= [current_year&month]? is it correct? this one also giving an error.

Please suggest the same and iam not sure how to work with DMR this is the 1st time am working.  Sorry MF for not posting proper comments, going 4wds i will do properly.

MFGF

Hi,

It looks like you have some complicated expression which is invalid. What is the expression you are using? Is it all included in the error or is this just part of it?

One initial observation - you are mixing database functions and Cognos functions in the same expression. Why are you using to_char() rather than the Cognos cast() function? What data type is your [year] item? What is in it?

You indicated you have an error with your filter, too, but you didn't give any clue what the error is.

MF.
Meep!