Problem with Java expressions


I'm using Jasper Report library 6.2.0 with PHP, so I deployed PHP/Java Bridge on Tomcat 7.

I tested it with a simple report and it worked. Then I moved to the final and more complex report and I got some issues.

To build the .jrxml I'm using Jasper Studio

1) First I discovered making some test with the same report, that to avoid problems when I run the report from php, I must use JAVA as language for expressions in the report

2) I converted my javascript expressions to java but when I insert these 2 variables in the report, It gives me an error when I try to run the report from php. If I remove them it works fine.
So I think there is some error inside the expressions

<variable name="tipo_pagamento" class="java.lang.String">
<variableExpression><![CDATA[IF($F{type} == "BB","Bonifico Bancario","Carta di credito")]]></variableExpression>
<variable name="pagamento" class="java.lang.String">
<variableExpression><![CDATA[IF($F{type} == "BB",SUBSTITUTE($F{causale},"<br />",""),"Pagata - " + $F{transaction_id})]]></variableExpression>


matteo.agostoni's picture
Joined: Mar 4 2016 - 3:12am
Last seen: 7 years 4 months ago

1 Answer:

Instead of "IF", use "?" notation.


$F{type}.equals( "BB")?"Bonifico Bancario":"Carta di credito"

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 years 3 months ago