COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: srikanthshonti on 02 Apr 2012 10:01:49 AM

Title: Formating issue and Substring issue
Post by: srikanthshonti on 02 Apr 2012 10:01:49 AM
Hello All




I have Formatting issue in the report which contins the names of the countries impacted in one single cell. the string length is not fixed.

For ex:

COUNTRYIMPACTED
APIMEA  - South Africa ; Europe  - Bulgaria ; Europe  - Russia
APIMEA  - India ; APIMEA  - Indonesia ; APIMEA  - Thailand ; Europe  - Turkey
Europe  - France ; Europe  - Norway ; Europe  - Poland ; Europe  - Spain
Europe  - Germany ; Europe  - United Kingdom
Europe  - United Kingdom

I want all the countries of this come as a seperate row for each country along with the regieon names. something similar to this please help me to fix this issue. Tried using substring etc but did not worked

COUNTRYIMPACTED
APIMEA  - South Africa
Europe  - Bulgaria
Europe  - Russia
APIMEA  - India
APIMEA  - Indonesia
APIMEA  - Thailand
Europe  - Turkey
Europe  - France
Europe  - Norway
Europe  - Poland
Europe  - Spain
Europe  - Germany
Europe  - United Kingdom
Europe  - United Kingdom


Thanks in advance
Title: Re: Formating issue and Substring issue
Post by: MFGF on 02 Apr 2012 11:42:44 AM
Hi,

This looks like a similar kind of issue to the one being discussed here:

http://www.cognoise.com/community/index.php/topic,18877.0.html

Both are examples of data which is not normalised and therefore difficult to manupulate using tools which generate SQL (such as Cognos 10). Your easiest solution would be to pivot the multi-values to different rows in the underlying data source using a tool designed to handle these kinds of transformations - Cognos 10 Data Manager will do this, for example. Otherwise, you will have to resort to very messy calculations in your report. To quote a close friend - you should " flog any data architect involved with a wet noodle" for providing reporting data in this form! :)

MF.
Title: Re: Formating issue and Substring issue
Post by: srikanthshonti on 02 Apr 2012 12:38:11 PM
Hi MF

Thanks a lot for your reply!!! I have the countries of around 158..... as such. any better solutions from the reporing end would be really very helpful. Thank you once agian. I was tring the metod as suggested

For Ex:  [TheString] --> 1000;Cognos;ABC123

Split 1 (1000): substring( [TheString], 1, position( ';', [TheString] )-1)

Split 2 (Cognos): substring( [TheString], position( ';', [TheString] ) +
1 , position( ';', substring([TheString], position( ';', [TheString] )
+ 1) ) - 1)

Split 3 (ABC123): substring( [TheString], 1 + (position( ';',
[TheString] ) + 1) + (position( ';', substring([TheString], position(
';', [TheString] ) + 1) ) - 1))


Srik
Title: Re: Formating issue and Substring issue
Post by: MFGF on 03 Apr 2012 04:29:53 AM
Your approach is pretty much the only way to go from within a report, and is quite messy as you can see. If your database supports functions which might make this easier (left, reverse etc), you could try using them in your expression, but if not you're pretty much limited to substring() and position()

Regards,

MF.