COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: sspk on 29 Jan 2008 10:11:36 AM

Title: dynamically column names and the best way to do it
Post by: sspk on 29 Jan 2008 10:11:36 AM
Hi,
i have to generate a report which will have data-items like data_year,data_month(it will have past 24 months data in it),trx_data_bucket1....
Now  if data_month= NOV 2007  then i need to display trx_data_bucket1=NOV-07
trx_data_bucket2=oct-07,
trx_data_bucket3=sep-07
..
i.e when ever the data_month changes the  trx_data_bucket names has to change accordingly.
(sorry if i was not clear in explaning u guys, i am new to cognos)
Title: Re: dynamically column names and the best way to do it
Post by: Suraj on 29 Jan 2008 10:44:34 AM
do you have trx_data_bucket in the table or you are going to create it in report?
If you don't have it in table, i'll suggest to add these so that you don't have to calculate them in report.
Otherwise, you have to calculate them using a long case statement similar to...
case
when month = nov and year = 2007 then trx_data_bucket1
when month = oct and year = 2007 then trx_data_bucket2
when .... etc...
Title: Re: dynamically column names and the best way to do it
Post by: sspk on 29 Jan 2008 11:28:54 AM
Hi,
thank you for giving reply and i am sorry for not giving proper info
i have the trx_data_buckets in the table and one more thing in the report
when data_month =NOV 2007 then trx_data_bucket1=nov-07,trx_data_bucket2=oct-07,trx_data_bucket3=sep-07....
when data_month=OCT 2007 then trx_data_bucket1=oct-07,trx_data_bucket2=sep-07,trx_data_bucket3=aug-07....
when data_month=SEP 2007 then trx_data_bucket1=sep-07,trx_data_bucket2=aug-07,trx_data_bucket3=jul-07....
I have a prompt on data_month so when i select a month it should display as above.