COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: sunny bachan prasad on 30 Nov 2017 07:53:50 AM

Title: Alternate color formatting for list
Post by: sunny bachan prasad on 30 Nov 2017 07:53:50 AM
Hi,
I am using cognos 10.2 and have Oracle DB. I have a list inside list report which is connected through Master detail relationship and have to apply alternate color formatting to the list report any idea. How i can do it?

Thanks in adavnce,
Sunny
Title: Re: Alternate color formatting for list
Post by: BigChris on 30 Nov 2017 08:02:54 AM
I haven't done it in a very long while, but the principle is that you create a running-count of the records, then find the modulus of dividing that by two. You then set up a conditional format based on that mod whereby if it's 0 you set the background to be one colour, and when 1 you set it to another.
Title: Re: Alternate color formatting for list
Post by: Stepharia on 30 Nov 2017 11:51:04 PM
You can use the RowNumber() function with the modulus function which BigChris mentioned to achieve this.

mod (RowNumber (), 2) = 0

Enter the above as an advanced condition under conditional styles and set the formatting for it.
Title: Re: Alternate color formatting for list
Post by: sunny bachan prasad on 01 Dec 2017 01:57:07 AM
Hi BigChris/Stepharia,
Thanks for your time but these code will not work in my senario. Since i have a list inside list which are connected through M/D relationship and we are showing data from both the list.So when i am applying color formatting on outerlist inner  all row of the inner list are getting colored.
Title: Re: Alternate color formatting for list
Post by: hespora on 01 Dec 2017 02:45:55 AM
Works just fine with a nested list; see screenshot attached.

This is one conditional style applied to both columns of the outer list, coloring in gray and silver, and a *different* conditional style in the nested list, coloring in teal and lime.
Title: Re: Alternate color formatting for list
Post by: sunny bachan prasad on 01 Dec 2017 07:37:59 AM
Thanks for  all for the time. Its working correctly now.