COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Steve on 10 Feb 2011 12:20:33 PM

Title: Concatenate two columns into One
Post by: Steve on 10 Feb 2011 12:20:33 PM
I am using a Cube package. I need to add two columns from the same dimension but different levels (Name and Code) into one column to show 'Name - Code'.

What expression should I use?

Thanks !
Title: Re: Concatenate two columns into One
Post by: Arsenal on 10 Feb 2011 12:30:50 PM
Why not just do this at the FM level (by concatenating required data items) and then building a dimension off this concatenated data item?
Depending upon the number of records the cube will have, there might be a build time overhead but I feel this would give you a cleaner solution.

Open to suggestions by others.
Title: Re: Concatenate two columns into One
Post by: Steve on 10 Feb 2011 12:36:09 PM
Whoa ! Got it !

The Long Name and Short Name property works for this. No need to change the cube or FM Model for this.

[Cube].[Heirarchy].[Level].[Name].[Name - Long Name] + ' - ' + [Cube].[Heirarhcy)].[Level].[ID].[ID - Long Name]
Title: Re: Concatenate two columns into One
Post by: MFGF on 10 Feb 2011 04:29:06 PM
Is this in a List report? If so, you could drag the first item in as a column, press the padlock button to unlock your structure, then drop a text item inside the same column (' - ') followed by the second item. This removes the need for a calculation and so makes the report slightly more efficient.

Just a thought.

MF.
Title: Re: Concatenate two columns into One
Post by: Steve on 10 Feb 2011 04:37:44 PM
Thanks ! Definately a good thought !

Actually I did this to create this value for a Prompt so I just created a Query and crated a Data Item for this.