COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: dinos on 24 Nov 2009 04:36:45 PM

Title: Build a list that dynamically creates rows based on data items?
Post by: dinos on 24 Nov 2009 04:36:45 PM
Hi,

I have the following data:

ID  Number
1   2
2   1
3   null
4   2
5   4

I want to create a list report that will introduce a new column (Number2) that will increment for ID till it reaches the value of Number.  So, with the data above, the desired result would look like this:

ID Number Number2
1  2          1
1  2          2
2  1          1
4  2          1
4  2          2
5  4          1
5  4          2
5  4          3
5  4          4

Is this at all possible using an existing Cognos function?
Title: Re: Build a list that dynamically creates rows based on data items?
Post by: DSR on 25 Nov 2009 01:03:59 AM
Hi ..

You can use running count function for the ID which you display in your report...Which will gives you the exact result as you mentioned in the list.

Regards,
Sanjeev
Title: Re: Build a list that dynamically creates rows based on data items?
Post by: dinos on 25 Nov 2009 09:02:41 AM
Hi,

Running count on ID would generate this result.

ID  Number  Number2
1   2          1
2   1          1
3   null       1
4   2          1
5   4          1

I looked at doing this with running count, but cannot get the list to show as my second example in my original post.

I need to create a form that will display a list of Items and for each item, present a series of lines where and individual can manually write an entry onto the form.  Consider it like a log. Number represents a count that is done on the database side that represents the number of lines I need to display.

The solution I came up with was to create a list that would introduce that third column (Number2), embed it within a master list where I have breakdown of items as well as other data, and to create a master-detail relationship between the two lists (linking by the ID column).  I would then cut the 2 first columns, only to leave the Number2 column, remove the value for Number2 from the list (so that it doesn't appear) and underline that cell so that it appears as an underline within the final form.  Does this make sense?  Perhaps there is another more efficient approach?