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

changing the label of data name based on other column

Started by Manu0521, 16 Apr 2014 01:18:49 PM

Previous topic - Next topic

Manu0521

I will be using three data items which will be calculated from current year, say the column names can be
2013
2014
2015

or it could be 2012
                      2013
                      2014

Now my new 2 columns will find the change in value for the above three columns.

say it could be 2012-2013 or 2013-2014

since I have 3 data items I can subtract the first 2 and last 2 but how do dynamically name them

Thanks,

navissar

You could try to use a report expression for your column header, instead of member caption/data item label. Then write an expression which will take the dynamic values of the relevant data items...

navissar

For future people's reference (Hello people from the future! Have you worked out global warming yet, or are you all wearing shorts?)
Manu had written me that he had tried these expressions:
extract(year,current_date) or extract(year,today())
and got a parsing error.

I had answered that when extract is used in the context of a report expression, it is an extremely unforgiving function.
First, the date it is fed HAS TO BE either a timestamp or a date-time type. current_date isn't a report expression, and today() returns a date, not date-time. So, the date part should look like this: date2timestamp (today())
This will convert today's date to a timestamp with 00:00:00.000 as the time.
Next, it doesn't say so in the documentation (Kudos, IBM), but the date part should be in single quotes. So, to get today's year in a report expression we need to use the following syntax:
extract('year',date2timestamp (today()))
and if we want to make the thousand separator disappear, we need to cast the whole thing to text, so the expression is:
number2string(extract('year',date2timestamp (today())))

Manu0521