COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: hana00 on 20 Sep 2017 04:39:47 AM

Title: Dynamic number of columns in report
Post by: hana00 on 20 Sep 2017 04:39:47 AM
Hello All !

I have some problem with report in Cognos, I have googled it many times but unfortunatelly didn't find any sastisfying information  :(.

I would like to present table with dynamic number of coulms.
Data for dynamic columns are in the database by key - value, number of attributes can be different and also attributes can be various for objects (really important thing is that attributes can have numeric data types but also non-numeric, such as Varchar ), and they can look just like that

Parameter   Name of object   Attribute Name    Value

Parameter 1   Object 1   Attribute 1              Value 1
Parameter 1   Object 1   Attribute 2              Value 2
Parameter 1   Object 1   Attribute 3            Value 3
Parameter 1   Object 1   Attribute 4              Value 4
Parameter 1   Object 2   Attribute 1            Value 1
Parameter 1   Object 2   Attribute 2               Value 2
Parameter 1   Object 2   Attribute 3               Value 3
Parameter 1   Object 2   Attribute 4               Value 4
Parameter 1   Object 5   Attribute 6               Value 6
Parameter 2   Object 5   Attribute 7               Value 7
Parameter 2   Object 6    Attribute 6               Value 6
Parameter 2   Object 6   Attribute 7                Value 7


On Cognos we would like to present the data in that way:

SECTION BY: Parameter 1

Object Name     Attribute 1      Attribute 2       Attribute 3          Attribute 4
Object 1                Value 1        Value 2        Value 3               Value 4
Object 2                Value 1         Value 2        Value 3               Value 4



SECTION BY: Parameter 2

Object Name   Attribute 6    Attribute 7
Object 5            Value 6           Value 7
Object 6            Value 6           Value 7

Any idea how to do that??  :)


Title: Re: Dynamic number of columns in report
Post by: BigChris on 20 Sep 2017 05:02:08 AM
i might be missing something, but how are you constructing your database table so that it'll store multiple datatypes in the same Value field? Or are Value1, Value2 etc. separate fields?
Title: Re: Dynamic number of columns in report
Post by: hana00 on 20 Sep 2017 05:04:05 AM
They are stored row by row, new attribute is new row in database. 
Title: Re: Dynamic number of columns in report
Post by: BigChris on 20 Sep 2017 05:44:26 AM
Yep, I think I get that...it's the Value bit that I'm just not getting. What database are you using as your back end? It might be that I'm used to SQL server and you're using something different (are you?). The way you've laid it out, makes it look like there's a row for each Parameter / Object / Attribute combination, with a column (field) for Value. But then you say that that field (Value) can hold multiple data types. SO...the table would look something like:


ParameterObjectAttributeValue
P1O1A1"Elephant"
P1O1A22017-09-20
P1O1A342

Or have I completely misunderstood?
Title: Re: Dynamic number of columns in report
Post by: Invisi on 25 Sep 2017 10:23:57 AM
Typically that column would be a string (varchar)? With all related issues?