COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: lporter on 22 Jun 2011 10:45:40 AM

Title: AS OF month-year displayed in Report Title
Post by: lporter on 22 Jun 2011 10:45:40 AM
I have a crosstab report (Cognos8) that compares values current YTD to prior YTD.  The report has 2 prompts - ?Last Calendar Year? and ?Last Calendar Month? where Calendar Month is the month number.  There are then 2 filters: Calendar Year >= (?Last Calendar Year?) and Calendar Month <= (?Last Calendar Month?).  I want to display the values entered for the prompts in the report title with 'As Of MMM,YYYY'.  This also means I would need to convert the Month Number to the Month Name, and add one year to the value entered in the Year Prompt.  How would I display the prompt values, convert the month value and calculate the year value?
Title: Re: AS OF month-year displayed in Report Title
Post by: PRIT AMRIT on 22 Jun 2011 09:20:59 PM
'As Of'+' '+
case ParamDisplayValue('Mth')
when '1' then 'JAN'
when '2' then 'FEB'
-----
-----
when '12' then 'DEC'
end
+','+
number2string(string2int32(ParamDisplayValue('Yr'))+1)


Replace Year & Month parameter as in your report. Hope it resolves?

Thanks
Title: Re: AS OF month-year displayed in Report Title
Post by: lporter on 23 Jun 2011 09:38:02 AM
How am I inserting this code into the header - as a Query Calculation?  I can insert the 'As Of:' as a Text Item, but am not sure how to insert the code.
Title: Re: AS OF month-year displayed in Report Title
Post by: lporter on 23 Jun 2011 10:16:24 AM
Actually, I tried this code as a Query Calculation, but get the error that the function ParamDisplayValue is not supported (using DB2). :(
Title: Re: AS OF month-year displayed in Report Title
Post by: Lynn on 23 Jun 2011 02:58:50 PM
I believe that would be a layout calculation