wegnerk Posted September 6, 2006 Share Posted September 6, 2006 Hi, another small problem... in my database, there are normal customers with own name, but there are also some rows, which have no value, null in this case. For the report i need to rename that field 'customer', when there is null in there. i tried to write an if-term, but nothing worked... the field is of type STRING. Any ideas? thanks in advance Link to comment Share on other sites More sharing options...
lucianc Posted September 6, 2006 Share Posted September 6, 2006 You can use the "? :" Java operator to do something like this:Code:$F{customer} == null ? "No name" : $F{customer} HTH,Lucian Link to comment Share on other sites More sharing options...
wegnerk Posted September 6, 2006 Author Share Posted September 6, 2006 it works... thanks a lot, lucian!! Link to comment Share on other sites More sharing options...
wegnerk Posted September 6, 2006 Author Share Posted September 6, 2006 Hi,now i have another strange thing. after i changed that textfield, that works, but in another textfield 'YEAR' the function 'print repeated values' does not work anymore. I mean, i don't want every year printed more than one time and i used that function for that. but now, that doesnt work anymore. what has the one thing to do with the other? Link to comment Share on other sites More sharing options...
lucianc Posted September 6, 2006 Share Posted September 6, 2006 Are you sure it's related to the change you made on the other text field? If you revert the change, does the Year text field stop printing repeated values? Link to comment Share on other sites More sharing options...
wegnerk Posted September 6, 2006 Author Share Posted September 6, 2006 i really don't know why it doesn't work anymore... i just deleted that expression, but the problem is always there, so you are right, it seems not to be dependant... is it possible, that it has to do with the version? I just installed the new jasperreport 1.2.6 and i-report 1.2.6 today. any idea? edit:Just tried it with 1.2.5 version and there is the same problem. when i take that specific statement, the 'print repeated values' expression is neglected...Post edited by: wegnerk, at: 2006/09/06 08:22 Link to comment Share on other sites More sharing options...
lucianc Posted September 6, 2006 Share Posted September 6, 2006 Could post a relevant JRXML fragment? Link to comment Share on other sites More sharing options...
wegnerk Posted September 6, 2006 Author Share Posted September 6, 2006 surely.... here is the fragment, where both textfields are in: Code:<textField isStretchWithOverflow="false" Pattern="###0" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" ><reportElementmode="Opaque"x="5"y="0"width="100"height="15"key="textField"isPrintRepeatedValues="false"/><box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/><textElement verticalAlignment="Middle"><font/></textElement><textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{JAHR}]]></textFieldExpression></textField><textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" ><reportElementx="115"y="0"width="233"height="15"key="textField"isPrintRepeatedValues="false"/><box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/><textElement verticalAlignment="Middle"><font/></textElement><textFieldExpression class="java.lang.String"><![CDATA[$F{HAERTEFALL} == null ? "Normalverbraucher" : $F{HAERTEFALL}]]></textFieldExpression></textField> The Field HAERTEFALL is the customer, and JAHR is year... i changed nothing else... Link to comment Share on other sites More sharing options...
wegnerk Posted September 6, 2006 Author Share Posted September 6, 2006 that is really strange... it works, when i start it in ireport, but i wrote a small java-environment to start the reports, and there, it does not work, but it is important, that it works there... so, do you have a clue where the fault can be? Post edited by: wegnerk, at: 2006/09/06 08:40 edit: seems to be a problem of the new version 1.2.6. I started it in java with jasperreports-1.2.5.jar and there, it worked. so i will use this one. thanks for your hints, lucian!Post edited by: wegnerk, at: 2006/09/06 08:45 Link to comment Share on other sites More sharing options...
lucianc Posted September 6, 2006 Share Posted September 6, 2006 Indeed, this is a very nasty (and stupid) bug introduced in JR 1.2.6. I've logged it here. The fix is available on SourceForge's CVS. Regards,Lucian Link to comment Share on other sites More sharing options...
wegnerk Posted September 6, 2006 Author Share Posted September 6, 2006 that was fast... thanks a lot! 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