Krac Posted February 21, 2007 Share Posted February 21, 2007 Hello, JasperReports-people! Is there any possibility to alternatively-color/fill the rows background for a crosstab, depending on the current row number in the crosstab? I would like a condition that resembles the following: new Boolean(($V{ROW_COUNT}.intValue()%3) == 0) where ROW_COUNT is the number of rows in the crosstab. Example: 1st row is RED, second is YELLOW, third is BLUE (Hai Romania!) or RED-WHITE-GREEN (Viva Italia!) and so on... Is there any BUILT-IN variable that automatically counts the rows for a crosstab? TIA, Razvan Post edited by: Krac, at: 2007/02/21 14:03Post edited by: Krac, at: 2007/02/21 14:03 Link to comment Share on other sites More sharing options...
lucianc Posted February 21, 2007 Share Posted February 21, 2007 The ROW_COUNT and COLUMN_COUNT variables are available in crosstabs. One can achieve alternate colors for crosstab rows using these variables and conditional styles. The OrdersReport sample found in the JasperReports project package under demo/samples/crosstabs illustrates this. HTH,Lucian Link to comment Share on other sites More sharing options...
Krac Posted February 22, 2007 Author Share Posted February 22, 2007 Thanks a lot, Lucian, you just made my day :) Link to comment Share on other sites More sharing options...
sgstafford Posted January 14, 2008 Share Posted January 14, 2008 Can you tell me where this sample is or give me a hint on getting the alternate row colors to work in crosstabs? Link to comment Share on other sites More sharing options...
lucianc Posted January 14, 2008 Share Posted January 14, 2008 The JasperReports samples are located in the JasperReports "project" distribution. More details in this topic. HTH,Lucian Link to comment Share on other sites More sharing options...
jyotic Posted March 4, 2008 Share Posted March 4, 2008 Hi, I am also doing the alternate color. Is there any other way to do it. As in without using ROW_COUNT? In my scenario ROW_COUNT is not working. What i have 2 rowGroups. The row count is determined by the inner one, and for the outer one i want alternate color. I'have tried condition style. But since i am getting odd in all the case, the color for outer row group is coming out to be same. A1 B1 <grey>- B2 <white>- Total <blue>A2 B1 < grey>- B2 < white> In this both A1 and A2 are getting same color, as row_count for them is 1 and 3. How can i get them to have different color? Thanks,Jyoti Code: <style name="detailCellStyle"> <conditionalStyle> <conditionExpression>$V{ROW_COUNT}.intValue() % 2 == 1 ? Boolean.TRUE : Boolean.FALSE</conditionExpression> <style backcolor="#DDDAC0" mode="Opaque" forecolor="black"/> </conditionalStyle> <conditionalStyle> <conditionExpression>$V{ROW_COUNT}.intValue() % 2 != 1 ? Boolean.TRUE : Boolean.FALSE</conditionExpression> <style backcolor="white" mode="Opaque" forecolor="black"/> </conditionalStyle> </style> Link to comment Share on other sites More sharing options...
ljz2008 Posted March 5, 2008 Share Posted March 5, 2008 ROW_COUNT worked! But in iReport 2.0.4, "Variable ROW_COUNT not found!".Did not iReport 2.0.4 say supporting for JR 2.0.4? :silly: Link to comment Share on other sites More sharing options...
dragonflydata Posted March 27, 2008 Share Posted March 27, 2008 I must be doing something wrong. In iReport v2.0.5 (nor 2.0.3) I cannot find a variable ROW_COUNT. This would be rather helpful I think. Post edited by: dragonflydata, at: 2008/03/26 20:38Post edited by: dragonflydata, at: 2008/03/26 20:38 Link to comment Share on other sites More sharing options...
lucianc Posted March 27, 2008 Share Posted March 27, 2008 dragonflydata wrote:In iReport v2.0.5 (nor 2.0.3) I cannot find a variable ROW_COUNT. This would be rather helpful I think. iReport related issues should be posted on the iReport forum. Regards,Lucian Link to comment Share on other sites More sharing options...
dragonflydata Posted March 27, 2008 Share Posted March 27, 2008 My bad. Started in iReport forum, searched, found this thread and posted. I will be more careful. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now