rasikow Posted January 16, 2009 Share Posted January 16, 2009 Hi all, i want to change color of field dynamically? is it possible through jrxml?For example,if field is G, it should be Green color, if R, it should be Red color your swift reply shall be highly appreciated. Thanks in Advance - Gnaniyr Zubair Link to comment Share on other sites More sharing options...
rasikow Posted January 16, 2009 Author Share Posted January 16, 2009 Thanks. i have got solution from one forum. her is code: ($F{currentStatus}.equals("Submitted"}) ? " " : $F{currentStatus} ) Link to comment Share on other sites More sharing options...
rasikow Posted January 16, 2009 Author Share Posted January 16, 2009 rasikowWrote: Thanks. i have got solution from one forum. her is code: ($F{currentStatus}.equals("Submitted"}) ? " " : $F{currentStatus} ) if i use like this, ($F{currentStatus}.equals("Submitted"}) ? "<style forecolor='red'>"+ $F{currentStatus}+"</style>: " : $F{currentStatus} ) i got the output: <style forecolor='red'> instead of changing text color. Link to comment Share on other sites More sharing options...
phantastes Posted January 16, 2009 Share Posted January 16, 2009 rasikow,You could set up different Styles or you could use two different fields with different font colors. Then put the a filter in the "Print When Expression" :new Boolean($F{currentStatus}.equalsIgnoreCase("Submitted") == true) Magnus Link to comment Share on other sites More sharing options...
drlaz Posted January 16, 2009 Share Posted January 16, 2009 Did you remember to set Markup to styled? Link to comment Share on other sites More sharing options...
rasikow Posted January 19, 2009 Author Share Posted January 19, 2009 phantastesWrote: rasikow, You could set up different Styles or you could use two different fields with different font colors. Then put the a filter in the "Print When Expression" : new Boolean($F{currentStatus}.equalsIgnoreCase("Submitted") == true) Magnus Hi Magnus, Thanks for your reply. yaeh i got the point.But i dont know how to use Print When Expression as i dont get proper documentation. can u pls guide on this?Also i used the HTML Markup for that particular field. but it is not working. Thanks in advance - Gnaniyar Zubair Link to comment Share on other sites More sharing options...
dprogrammer Posted January 19, 2009 Share Posted January 19, 2009 Hi Guys, I am also looking for this solution. I don't see anything when I click the drop down "Style". I am using version 1.2.x of iReport.I am also trying two text boxes with two different colors logic but not sure why my expression is not evaluating correctly. I have two dates, I want to show textbox1 with blue color only when the start_date<>EndDate. If both dates are equal, then I want to show textbox2 with black color. The problem is my expression is returning only one textbox1 in all cases. I wish I could change the font color dynamically with some other logic. Here is what I have.//TextBox1 - text color is Blue$F{Start_Date}==$F{End_Date}?Boolean.FALSE:Boolean.TRUE //TextBox2 - text color is Black$F{Start_Date}!=$F{End_Date}?Boolean.FALSE:Boolean.TRUE Link to comment Share on other sites More sharing options...
svenn Posted January 19, 2009 Share Posted January 19, 2009 Start_Date and End_Date are defiend as what data type? Link to comment Share on other sites More sharing options...
dprogrammer Posted January 19, 2009 Share Posted January 19, 2009 Both are defined as date. But I was able to figure out after little searching. The following expressions are working fine: Box1:(blue color) //for equal to $F{START_DATE}.equals($F{END_DATE})?Boolean.FALSE:Boolean.TRUE Box2: (black color) //for not equal to !($F{START_DATE}.equals($F{END_DATE}))?Boolean.FALSE:Boolean.TRUE Link to comment Share on other sites More sharing options...
mauropiro Posted February 12, 2009 Share Posted February 12, 2009 Dear Gnaniyr Zubair I found out a way to do this: in the TEXT FIELD: ($F{sysdate-4}.compareTo(new BigDecimal(0)) <= 0?" ":String.valueOf($F{sysdate-4}).toString()) I wanted the color RED case the cash balance < 0. And that worked fine. Mauro Link to comment Share on other sites More sharing options...
ajaynayak Posted April 26, 2012 Share Posted April 26, 2012 Hi Mauro,Could you please explain what you did in your case?If you share some snap of code here that could be easy to understand too.Thanks,Ajay Link to comment Share on other sites More sharing options...
aaa_aaa Posted April 27, 2012 Share Posted April 27, 2012 hello all, i don't oppened new topic bcz i have similar problem but i want to make borderi did this $F{NAME}=="Submitted1"?$F{NAME}:"<style backcolor='red'>"+$F{NAME}+"</style>"but if i want border around text style isn't recognize border in this styleanyone can help me? Link to comment Share on other sites More sharing options...
aaa_aaa Posted April 27, 2012 Share Posted April 27, 2012 and i have one more questionhow to do align text of textField? Link to comment Share on other sites More sharing options...
elviejoguille Posted April 27, 2012 Share Posted April 27, 2012 Hello Everyone, I resolved this problem with the styles option,in the left menu REPORT INSPECTORSTYLESNEWand config the properties field wiht this styleattach pictures with the description. Code: Post Edited by elviejoguille at 04/27/2012 21:35 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