COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: mohammed_hajat on 26 Nov 2009 08:16:07 AM

Title: Joining two data items to create a ratio
Post by: mohammed_hajat on 26 Nov 2009 08:16:07 AM
Right..

I spoke to Cognos Support and got informed Ratios as a standard is not part of Cognos.
so i worked it around and ended up with two data items.

DataitemA and DataitemB

what i want to do is show:

DataitemA : DataitemB

so the result will be for e.g 1 : 2

I have tried to create a third data item like so:

[dataitemA]+':'+[DataitemB]  <--- this errors?

what widget from the tool box is best to join two data items? and what is the syntax?
Title: Re: Joining two data items to create a ratio
Post by: bgamoretti on 26 Nov 2009 08:46:01 AM
try with:

[dataitemA] || ':' || [DataitemB]


Regards,
Bryan
Title: Re: Joining two data items to create a ratio
Post by: angela on 27 Nov 2009 06:30:07 AM
It'll error if the data items are numeric and you're trying to concatenate it with a string because you're mixing data types.  Your choices are either to display all 3 items in one cell or to cast the numeric items as char.  Personally, I'd go with option 1 - unlock the report and in the place I want the ratio to show I'd drag in both data items and drag a text item between them for the colon.
Title: Re: Joining two data items to create a ratio
Post by: mohammed_hajat on 30 Nov 2009 10:17:00 AM
thats exactly what i did, thank you.