COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: dipesh_mistry on 03 Oct 2007 08:23:34 AM

Title: Displaying different colors for alternate rows
Post by: dipesh_mistry on 03 Oct 2007 08:23:34 AM
Hi All,
I have a list report in which I want to display the records  fetched into two different colors in the list.Please suggest.

Regards,
dipsy
Title: Re: Displaying different colors for alternate rows
Post by: almeids on 03 Oct 2007 08:51:57 AM
This is a fairly common technique which you should find described in the ReportNet forums, FAQs, or Cognos' Knowledge Base.
Title: Re: Displaying different colors for alternate rows
Post by: MFGF on 03 Oct 2007 09:34:14 AM
Hi,

Almeids is correct - this is a well-known technique.  The basics are:

1. Add a query calculation containing a running-count summary eg running-count([Order_no])
2. Add a second query calculation as follows: mod([First calc],2)
3. Set up a boolean variable in the condition explorer with the expression [Second calc] > 0
4. Select 'list columns body style' using the Select Ancestor button, select the Style Variable property, and pick your boolean variable.
5. Hover your mouse over the Condition Explorer, select the 'Yes' variable value, then set the Background Colour property.  Using the condition explorer, switch to the 'No' variable value and repeat using a different colour.
6. If your calculations exist in the query but are not shown in the list, select the list using the Select Ancestor button, go to the Properties property, and enable the calculations as properties of the list.

Regards,

MF.
Title: Re: Displaying different colors for alternate rows
Post by: dipesh_mistry on 04 Oct 2007 01:19:19 AM
Hi,
Thanx for the reply...
Actually i have implemented dynamic sorting in my reports.... so whenever i click on any of the columns of the list report the  order of the color becomes uneven.... i.e. alteranate colors for the rows is not maintained.
Any suggestions on this plz.....

Regards,
dipsy
Title: Re: Displaying different colors for alternate rows
Post by: MFGF on 04 Oct 2007 02:47:14 AM
Depends... How did you implement your dynamic sorting?

MF.
Title: Re: Displaying different colors for alternate rows
Post by: nosub on 05 Oct 2007 10:22:06 AM
Have you tried using RowNumber() report expression as opposed to running-count?
Title: Re: Displaying different colors for alternate rows
Post by: dipesh_mistry on 08 Oct 2007 05:08:23 AM
Hi,
Its not allowing me to use RowNumber() in a dataitem.

Regards,