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

'Print when expresion' Error evaluating expression


csagar

Recommended Posts

Hello friends,

I am using ireport 3.0.0 .In detail band  I use three different dynamic text fields at the same location [overlapping on each other] but having different ' Print when expression'   condition. It works fine with ireport alone. see the output in attached image.

 

However when i use this JRXML file in my web application [liferay 5.2, jdk 1.5]   it gives following error-

 

[#|2009-04-18T16:08:32.850+0530|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=147cd69c-94f7-4836-ab17-e5e1461d3708;|
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : 
                Source text : (($F{cellNameCount}.intValue()>=3 && $F{cellNameCount}.intValue()<=4 )?new Boolean(true) :new Boolean(false))
                at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(JREvaluator.java:257)
                at net.sf.jasperreports.engine.fill.JRCalculator.evaluateEstimated(JRCalculator.java:565)
                at net.sf.jasperreports.engine.fill.JRCalculator.estimateVariables(JRCalculator.java:169)
                at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:765)
                at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1402)
                at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:111)
                at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:888)
                at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:810)
                at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)
                at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
                at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:582)
 

If I remove that print when expression and deploy the file in web application ,it works fine but without color coding which I need badly.

If anybody could throw some light on the issue I would be very thankful...

 

Lucian, Teodord- i'm sure you would be knowing the reason behind this issue...i'll be waiting for the reply from the masters : )

 

Link to comment
Share on other sites

  • Replies 12
  • Created
  • Last Reply

Top Posters In This Topic

one more post with same proble.....i fear that this is a bug which has not been resolved since 2006

http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=10122

and that person have received no response .... : (

 

@Creators of Jasper : I request you guys to help us out....it seems so many people have been facing the same problem since long..

Link to comment
Share on other sites

coplete log of my error-- meanwhile i tried changing the syntax of --

 

(
(($F{cellNameCount}.intValue()==1)||($F{cellNameCount}.intValue()==2))?Boolean.TRUE:Boolean.FALSE
)
 

as per one of the posts on the forum.... but in vain... no good news so far :(

Code:


Post Edited by csagar at 04/21/2009 09:20
Link to comment
Share on other sites

Hi Lucian,

Thanks for your reply.

Here, I have attached the error log file and jrxml file.I have tried various syntax of print when expression but none of them worked so far.

1.

((($F{cellNameCount}.intValue()==1)||($F{cellNameCount}.intValue()==2))?Boolean.TRUE:Boolean.FALSE)

2.

new Boolean((($F{cellNameCount}.intValue()==1)||($F{cellNameCount}.intValue()==2))?TRUE:FALSE)

3.

((($F{cellNameCount}.intValue()==1)||($F{cellNameCount}.intValue()==2))?new Boolean(TRUE):new Boolean(FALSE))

Also,

as per your reply on the posts-- the data type of the field is String. So I am very confused what's wrong in it.

Thanks,

Sagar.

 



Post Edited by csagar at 04/22/2009 05:25
Link to comment
Share on other sites

The JRXML that you posted does not correspond to the error log (the expression in the log is not present in the JRXML), so I don't have a good answer on what causes this.

As a guess, it might be that the cellNameCount field, which is declared as java.lang.Long in the JRXML, is actually set a java.lang.Integer value by the report data source.  I don't know why would this happen, but it would worth to try to change the field type to java.lang.Integer and see whether this fixes the error.

Regards,

Lucian

Link to comment
Share on other sites

It worked man !! I changed the type of CellNameCount to Integer and  it worked.  That was the problem.

It was working with Ireport [with cellNameCount as Long] but was not working with liferay, so it confused me .

Apologies for uploading older log file :|

Thanks a lot once again !! :)

 

Link to comment
Share on other sites

  • 1 year later...

Hi Lucian,

 

I am facing same error, but I am not using int or long anywhere.

 

following is the error I am facing:

O @@@@: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :

Source text : (!$F{dependantDOB1}.isEmpty() ? Boolean.TRUE : Boolean.FALSE)

 

 

<reportElement x="284" y="500" width="100" height="9" isRemoveLineWhenBlank="true">

 

and this is that part of JRXML: <printWhenExpression><![CDATA[(!$F{dependantDOB1}.isEmpty() ? Boolean.TRUE : Boolean.FALSE)]]></printWhenExpression>

 

would you happen to know what may have gone wrong in this case?

 

Thanks in advance.

</reportElement>

 

 

Link to comment
Share on other sites

here is the entire text field used in the JRXML:

 

<textField hyperlinkType="None">

<reportElement x="284" y="500" width="100" height="9" isRemoveLineWhenBlank="true">

<printWhenExpression><![CDATA[(!$F{dependantDOB1}.isEmpty() ? Boolean.TRUE : Boolean.FALSE)]]></printWhenExpression>

</reportElement>

<textElement>

<font size="7"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{dependantDOB1}]]></textFieldExpression>

</textField>

Link to comment
Share on other sites

  • 1 year later...

 

Hy, i'm having the same problem.  I'm using ireports 4.5.1, liferay bundled with tomcat 6, jdk 6.

 

This is my error log:

Caused by: org.apertereports.common.exception.AperteReportsRuntimeException: org.apertereports.common.exception.AperteReportsException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : 

Source text : ($P{REPORT_SCRIPTLET}.dateToTimestamp($P{DATA_INCEPUT})) <= (($F{DATA_CREARE}).intValue()) &&

($P{REPORT_SCRIPTLET}.dateToTimestamp($P{DATA_SFARSIT})) >= (($F{DATA_CREARE}).intValue())

at org.apertereports.components.ReportManagerComponent$ReportItemPanel$5.buttonClick(ReportManagerComponent.java:387)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)

... 171 more

Caused by: org.apertereports.common.exception.AperteReportsException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : 

Source text : ($P{REPORT_SCRIPTLET}.dateToTimestamp($P{DATA_INCEPUT})) <= (($F{DATA_CREARE}).intValue()) &&

($P{REPORT_SCRIPTLET}.dateToTimestamp($P{DATA_SFARSIT})) >= (($F{DATA_CREARE}).intValue())

at org.apertereports.engine.ReportMaster.generateReport(ReportMaster.java:415)

at org.apertereports.engine.ReportMaster.generateAndExportReport(ReportMaster.java:339)

at org.apertereports.engine.ReportMaster.generateAndExportReport(ReportMaster.java:346)

at org.apertereports.engine.ReportMaster.generateAndExportReport(ReportMaster.java:365)

at org.apertereports.components.ReportManagerComponent$ReportItemPanel$5.buttonClick(ReportManagerComponent.java:381)

... 176 more

Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : 

Source text : ($P{REPORT_SCRIPTLET}.dateToTimestamp($P{DATA_INCEPUT})) <= (($F{DATA_CREARE}).intValue()) &&

($P{REPORT_SCRIPTLET}.dateToTimestamp($P{DATA_SFARSIT})) >= (($F{DATA_CREARE}).intValue())

at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(JREvaluator.java:267)

at net.sf.jasperreports.engine.fill.JRCalculator.evaluateEstimated(JRCalculator.java:582)

at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:553)

at net.sf.jasperreports.engine.fill.JRFillDataset.evaluateFilter(JRFillDataset.java:994)

at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:892)

at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:864)

at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1435)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:126)

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:836)

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:746)

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)

at org.apertereports.engine.ReportMaster.buildJasperPrint(ReportMaster.java:528)

at org.apertereports.engine.ReportMaster.generateReport(ReportMaster.java:412)

... 180 more

Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date

at j91MAIA93Fluxuri32de32lucru32active_1341310271630_163453.evaluateEstimated(j91MAIA93Fluxuri32de32lucru32active_1341310271630_163453:527)

at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(JREvaluator.java:254)

... 193 more

 
Code:



Post Edited by thordin at 07/03/2012 10:32



Post Edited by thordin at 07/03/2012 10:33
Link to comment
Share on other sites

From the looks of it, the code that calls JasperReports sends String values for the DATA_INCEPUT/DATA_SFARSIT parameters, which are supposed to be java.util.Dates.  I see that you are using aperte-reports, which I assume manages the report execution including preparing values for the parameters.

I don't know anything about aperte-reports; my suggestion is to debug it and see what kind of values it sets for the two parameters.

Regards,

Lucian

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