how to use scriptlet in iReport

1. create your scriptlet and compile it, sample code is listed below.

package demo;

import java.math.BigDecimal;
import java.util.Date;
import net.sf.jasperreports.engine.JRDefaultScriptlet;

public class scriptletFXTaxForm extends JRDefaultScriptlet  {
CommonFunction cf;
public scriptletFXTaxForm(){
cf = new CommonFunction(true);
cf.ConnectToDB();
}
public BigDecimal Acca1(String sAcc){
BigDecimal dRet ;
dRet = BigDecimal.ZERO;

return dRet;
}
public String methodName(){
return “scriptletFXTaxForm";
}
}

2. add you scriptlet to iReport classpath, don’t forget add all used lib or jar into iReport classpath ( if you lost one of them, you can’t work correctly )

3. In iReport , add demo.scriptletFXTaxForm to Scriptlet Class property.

in this demo case , your should add sqljdbc4.jar to iReport classpath

see also

http://blog.sacaluta.com/2007/07/jasperreports-scriptlet-example.html

http://blog.sacaluta.com/2005/10/using-jasperreports-scriptlet.html

Unfortunately, I still can’t use scriptlet in Netbeans plugin iReport.

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

What is 4 + 11 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)