Jump to content
Changes to the Jaspersoft community edition download ×

Ireport+eclipse+SCRIPTLET works only in Ireport


jprohaska

Recommended Posts

Hi to all,

 

I build a report that worked fine in Ireport and in eclipse/tomcat, but as soon i've added a scriptlet in the group expression it does not work no more in eclipse/tomcat(but works OK in ireport)

I've created a class qdettaglioscheda_cat_opScriptlet in eclipse, but it seems like class qdettaglioscheda_cat_opScriptlet could not be found in eclipse/tomcat

 

-----------------------------------------

------ This is the tomcat error log:

-----------------------------------------

e.getStackTrace[Ljava.lang.StackTraceElement;@e73783 it.ssssss.bbbbbb.oooooo.segnalazione.JasperReportsIntro - <init>

e.getMessage()Errors were encountered when compiling report expressions class file:

 

 

1. The method diverso() is undefined for the type JRAbstractScriptlet

value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet) parameter_REPORT_SCRIPTLET.getValue()).diverso());

<----->

 

 

2. The method diverso() is undefined for the type JRAbstractScriptlet

value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet) parameter_REPORT_SCRIPTLET.getValue()).diverso());

<----->

 

 

3. The method diverso() is undefined for the type JRAbstractScriptlet

value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet) parameter_REPORT_SCRIPTLET.getValue()).diverso());

<----->

 

 

 

 

-----------------------------------------------------

---- Ireport Group expression

-----------------------------------------------------

$P{REPORT_SCRIPTLET}.diverso()

 

 

 

-------------------------------------------------

------- This is the scriptlet (i have also created in eclipse in default package)

----------------------------------------------------

import net.sf.jasperreports.engine.*;

 

public class qdettaglioscheda_cat_opScriptlet extends it.businesslogic.ireport.IReportScriptlet {

 

String CODICE_PRECEDENTE = new String("CD");

 

/** Creates a new instance of JRIreportDefaultScriptlet */

public qdettaglioscheda_cat_opScriptlet() {

}

 

public Boolean diverso() throws JRScriptletException

{

String CODICE_PARAGRAFO_FIELD = (String)this.getFieldValue("CODICE_PARAGRAFO");

String STRINGA_RITORNO = new String(" ");

 

if (CODICE_PRECEDENTE.equals(CODICE_PARAGRAFO_FIELD))

{

CODICE_PRECEDENTE = CODICE_PARAGRAFO_FIELD;

return Boolean.FALSE;

}

else

{

CODICE_PRECEDENTE = CODICE_PARAGRAFO_FIELD;

return Boolean.TRUE;

}

}

 

}

 

 

 

 

-----------------------------------------

----- JRXML file

-----------------------------------------

 

<?xml version=1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="qdettaglioscheda_cat_op"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

scriptletClass="qdettaglioscheda_cat_opScriptlet"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="1" />

<property name="ireport.encoding" value="UTF-8" />

<import value="java.util.*" />

<import value="net.sf.jasperreports.engine.*" />

<import value="net.sf.jasperreports.engine.data.*" />

 

<parameter name="SECONDO_IND" isForPrompting="false" class="java.lang.String"/>

<parameter name="CODICE_DEL_PARAGRAFO_PRECEDENTE" isForPrompting="false" class="java.lang.String"/>

<parameter name="CODICE_APPO" isForPrompting="false" class="java.lang.String"/>

<parameter name="NumeroScheda" isForPrompting="false" class="java.lang.String">

<defaultValueExpression ><![CDATA["CROP4362]]></defaultValueExpression>

</parameter>

<queryString><![CDATA[sELECT

*

FROM

XXXXXXXXX

WHERE

XXXXXXXXXXXXXXXXXXXXXXXXX

ORDER BY

XXXXXXXXXXXXXXXXXXXXXXXXXXXX

></queryString>

 

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

<group name="CODICE_DEL_CAMPO" isReprintHeaderOnEachPage="true" >

<groupExpression><![CDATA[$P{REPORT_SCRIPTLET}.diverso()]]></groupExpression>

<groupHeader>

<band height="15" isSplitAllowed="true" >

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Opaque"

x="2"

y="2"

width="175"

height="13"

forecolor="#000000"

backcolor="#CCCCCC"

key="textField-1"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font pdfFontName="Helvetica-BoldOblique" size="10" isBold="true" isItalic="true"/>

</textElement>

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

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Opaque"

x="178"

y="2"

width="354"

height="13"

forecolor="#000000"

backcolor="#CCCCCC"

key="textField-4"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font pdfFontName="Helvetica-BoldOblique" size="10" isBold="true" isItalic="true"/>

</textElement>

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

</textField>

.................................................................................................... .........................................................................

.................................................................................................... .........................................................................

.................................................................................................... .........................................................................

....................................................................................................

 

Post edited by: jprohaska, at: 2007/03/20 11:45

Post edited by: jprohaska, at: 2007/03/20 11:48

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

  • 7 years later...

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