Jump to content
Changes to the Jaspersoft community edition download ×

differentiating Odd and Even row in detail

2002 JI Open Discussion

Recommended Posts

By: Lal V K - lalnec

differentiating Odd and Even row in detail

2005-11-10 05:08


I have to differentiate odd and even rows with different color in details section.I would like to know how it could be done..I have tried with detail band Print When Expression.Its only accepting Boolean value.How I could set the color for alternative rows.


Pls help me.Its very urgent.


Thanks and regds,

V K Lal.





By: Daren O - rckrll106

RE: differentiating Odd and Even row in detai

2005-11-10 06:39

I created a rectangle in the background and for the print expression I used:

new Boolean(

($P{LineColor}.booleanValue()) &&

(((int)$P{LineSpace}.intValue() / 2) <= ($V{REPORT_COUNT}.intValue() % $P{LineSpace}.intValue()) )



note: I add the option to pass in two parameters. LineColor is a boolean to whether to use the color or not. LineSpace is of a multiple of 2 for how many lines to alternate (meaning the value of 2 will color every other line, 4 will color 2 lines, etc..)


Might be other ways but that is how I do it. Hope it helps.




By: TesTech - testech

RE: differentiating Odd and Even row in detail

2005-11-11 01:05

hi ..

The above posted solution can be simplified , without any parameters.


just copy all the fields in the detail section and paste it on the same location.


Choose one color to one set of fields and choose another color for the other set of fields.


Now , select one set fields and give the following expression (print when expression)for one set of fields


new Boolean((new Integer(($V{REPORT_COUNT}.intValue()) % (new Integer(2).intValue()))).equals(new Integer(0)))


and for the other set of fields and give

new Boolean((new Integer(($V{REPORT_COUNT}.intValue()) % (new Integer(2).intValue()))).equals(new Integer(1)))


Note : All the fields should be in a "Transparent" mode


Test this with only one field on details section.So that you can feel easy to set the property for other fields


This worked for me ! You try it !!




Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...