Jump to content
We've recently updated our Privacy Statement, available here ×

rename textfields with 'IF'


wegnerk

Recommended Posts

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

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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

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

surely.... here is the fragment, where both textfields are in:

 

Code:

<textField isStretchWithOverflow="false" Pattern="###0" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
mode="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" >
<reportElement
x="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

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

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...