ChristFollower Posted September 22, 2006 Share Posted September 22, 2006 I have a field, say $F{sex}, and the value from the database is either "F" or "M". On the report, I want to display Female and Male. How do I do that? Thanks. Link to comment Share on other sites More sharing options...
C-Box Posted September 22, 2006 Share Posted September 22, 2006 use this as TextFieldExpression: Code:$F{sex}.equals("F"«»)?"female":$F{sex}.equals("M"«»)?"male":"alien " ;) okay without the joke just: Code:[code]$F{sex}.equals("F"«»)?"female":"male" hthC-Box Link to comment Share on other sites More sharing options...
Mange Posted September 22, 2006 Share Posted September 22, 2006 Similar problem but formating ... I have $F{count} and if = 0 I want bold and red, otherwise just keep it default. Link to comment Share on other sites More sharing options...
C-Box Posted September 23, 2006 Share Posted September 23, 2006 Therefor you must define a Style where you set your attributes to your needs (red and bold) and set a condition to that style where you make as expression: Code:new Boolean($F{count}.equals(new Integer(1)) (assume that your field is of type Integer) then you just have to set this style to your TextField and voilá that's it. have a nice weekendhthC-BoxPost edited by: CBox, at: 2006/09/23 12:26 Link to comment Share on other sites More sharing options...
Mange Posted September 24, 2006 Share Posted September 24, 2006 Thanks C-Box! I can't figure out how/where to put it all together ... I create a Def style - default but no conditionsI create RedBold with Def as parent - conditions "new Boolean($F{numOfTD}.equals("0"))" (it is a string) I have tried to set none or both styles on the field and check/un-check the "Styled text" flag but always use Def or RedBold? What to put where in iRepoprt1.2.6? Link to comment Share on other sites More sharing options...
thiagot Posted October 2, 2006 Share Posted October 2, 2006 CBox I have an issue here I added a condition to the Style so it will change only when a text appearsnew Boolean($F{SERVICE}.equals("text")) I've tested it with Strike Through and underline, its okBut It will not change its color neither change background colorIs there anything special that must be set?I already changed the style to opaque and still don't work :( Link to comment Share on other sites More sharing options...
rsilverns.sympatico.ca Posted October 2, 2006 Share Posted October 2, 2006 You can also over-lay two fields on top of each other with the same expression and format them accordingly... then modify the printWhen expression to suit your needs. Link to comment Share on other sites More sharing options...
rsilverns.sympatico.ca Posted October 2, 2006 Share Posted October 2, 2006 You can also over-lay two fields on top of each other with the same expression and format them accordingly... then modify the printWhen expression to suit your needs. Link to comment Share on other sites More sharing options...
C-Box Posted October 3, 2006 Share Posted October 3, 2006 Which iReport are you using? I remember having the same trouble when I start using ConditionalStyles... it was because the element properties were overwriting the Style properties. I had to remove the Color Attributes from the TextElement (in Textpad pure JRXML edit) to get the Style working.... Teodor and Guilio would think about a solution.... I think it's working since 1.2.5 but not sure.... and because I'm still in (home) vacation - I have my samples all at work... so I will check at wednesday. till then C-Box Link to comment Share on other sites More sharing options...
Teodor Danciu Posted October 3, 2006 Share Posted October 3, 2006 thiagot, Can you show us the JRXML in which the colors in conditional style do not work? Thank you,Teodor 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