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

setting the element width/hide depends on the data


erosszz_jp

Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

i also encountered same requirement, actually i want to set the value of height and width property of reportElement from field value

example code is given

but getting this error:

net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '$F{PositionX}' is not a valid value for 'NMTOKEN'


please help, i am really stuck with this

Code:
<field name="PositionX" class="java.lang.Integer"/><textField isStretchWithOverflow="true" isBlankWhenNull="true"><reportElement x="40" y="0" width="$F{PositionX}" height="15" key="textField"/><textElement textAlignment="Center"><font pdfFontName="Helvetica-Bold" size="2" isBold="true"/></textElement><textFieldExpression class="java.lang.Integer"><![CDATA[$F{PositionX}]]></textFieldExpression></textField>

Post Edited by vsbait at 02/05/2010 07:27
Link to comment
Share on other sites

Hiii guys..

 

I have worked on some crossTab reports, but dont know whether we can achieve the changing of reportheight dynamically..but we can disable fields in report. Just pass condition in editExpression.

 

Eg

($V{field}.equals("a") ? $P{parameter1} : $P{parameter2}...

 

You should pass field value while populating values to report(mean to say set Field("a"), Field("b")...).

 

 

Hope this is the doubt you all have and iam clear in my explaination

Link to comment
Share on other sites

Thanks for your quick reply, now i can hope that their is some to help me.

 

But actually my requirement is a little different, actually i want to design the jasper report base on the values from the database, means i store elements x,y,width,height,style etc. to database, then i retrieve that values from database using queryString of jasper report, now i want to set these x,y,width,height values to the reportElement x,y,height,width

 

such as: <reportElement x="<here will be the xfield value from database>"/>

i use this <reportElement x="<![CDATA[$F{xfield}]]>"/>

but not working...

what can be the solution

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