rpozsgai Posted May 9, 2017 Share Posted May 9, 2017 I'm developing a set of Java beans to pass Notes/Domino data directly to a Jasper PDF report. I was successful creating a hard coded report with a sub-report, but when I tried to apply the same principles using Domino data, I received the above error. My actual report contains a sub-report and also a sub-subreport within that. During my debugging, I removed both the sub-report and the sub-subreport and then I was able to create the PDF with Domino data successfully.Feeling "smart", I put the first sub-report back in - no dice. Got the NotesContext error again. I then tried removing all the fields on the sub-report except for one - no difference. I then removed the last field on the sub-report. Nope, that didn't work either. So, I'm stumped and hoping someone here can direct me to what I'm missing.This is my managed bean:import java.io.Serializable;import java.util.HashMap;import java.util.Map;import java.util.ArrayList;import net.sf.jasperreports.engine.JasperExportManager;import net.sf.jasperreports.engine.JasperFillManager;import net.sf.jasperreports.engine.JasperPrint;import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;public class CreatePDFNoSubs implements Serializable { private static final long serialVersionUID = 1L; public CreatePDFNoSubs(){ //for managed bean } public void reportToFileNoSubs(String docnum) { try {System.out.println("setting reportname"); String jasperReport = "C://Users/RPo/Documents/Bob/Jasper Reports/HSD/HSD_Quote_JavaNoSubs.jasper"; String subReportWS = "C://Users/RPo/Documents/Bob/Jasper Reports/HSD/HSD_QuoteWS_JavaNoMisc.jasper"; String subReportMisc = "C://Users/RPo/Documents/Bob/Jasper Reports/HSD/HSD_QuoteMisc_Java.jasper"; String destReport = "C://JReports//HSD//"+docnum+".pdf"; System.out.println("setting parameters"); // Parameters for report Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("SubReportWS", subReportWS); parameters.put("SubReportMisc", subReportMisc); // DataSourceSystem.out.println("setting beancol datasrc"); DataBeanListNoSubs DataBeanList = new DataBeanListNoSubs(); ArrayList<DataBeanNoSubs> dataList = DataBeanList.getDataBeanListNoSubs(docnum); JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(dataList);System.out.println("calling jasperfillmgr"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,parameters,beanColDataSource); System.out.println("calling exporttopdf"); // Export to PDF. JasperExportManager.exportReportToPdfFile(jasperPrint,destReport); } catch (Exception e) { System.out.println("Error in CreatePDF: " + e); throw new RuntimeException("error in CreatePDF: ", e); } }} All of the Domino data gathering is done in this bean,import java.util.*;import lotus.domino.*;import com.ibm.xsp.model.domino.DominoUtils;public class DataBeanListNoSubs { // *** no sub report bean collections *** public ArrayList<DataBeanNoSubs> getDataBeanListNoSubs(String docnum) { //create the array to return ArrayList<DataBeanNoSubs> dataBeanList = new ArrayList<DataBeanNoSubs>(); //this will be a single record array consisting of a series of fields and array of ws subreport //fields that contains another array of misc subsubreport fields try{ Session sess = DominoUtils.getCurrentSession(); Database db = sess.getCurrentDatabase(); View baseview = db.getView("QuoteLetterBase_Java"); View wsview = db.getView("QuoteLetterWS");// View miscview = db.getView("QuoteLetterMisc");System.out.println("setting base data"); //get the base data ViewEntry ventry = baseview.getEntryByKey(docnum,true); String repquote = ventry.getColumnValues().get(1).toString(); String custname = ventry.getColumnValues().get(2).toString(); String custnum = ventry.getColumnValues().get(3).toString(); String custadd_2 = ventry.getColumnValues().get(4).toString(); String custadd_3 = ventry.getColumnValues().get(5).toString(); String custadd_4 = ventry.getColumnValues().get(6).toString(); String custadd_5 = ventry.getColumnValues().get(7).toString(); String custadd_6 = ventry.getColumnValues().get(8).toString(); String contact = ventry.getColumnValues().get(9).toString(); String contactemail = ventry.getColumnValues().get(10).toString(); String contactphone = ventry.getColumnValues().get(11).toString(); String program = ventry.getColumnValues().get(12).toString(); String inqnum = ventry.getColumnValues().get(13).toString(); String fob = ventry.getColumnValues().get(14).toString(); String terms = ventry.getColumnValues().get(15).toString(); String estimator = ventry.getColumnValues().get(16).toString(); String saleseng = ventry.getColumnValues().get(17).toString(); String expires = ventry.getColumnValues().get(18).toString(); String qnotes = ventry.getColumnValues().get(19).toString(); String bottomterms = ventry.getColumnValues().get(20).toString(); String tmp = ventry.getColumnValues().get(21).toString(); Double totalquote = Double.parseDouble(tmp); String docnumoption = ventry.getColumnValues().get(22).toString(); String datesentoption = ventry.getColumnValues().get(23).toString(); String id = ventry.getColumnValues().get(24).toString(); String draft = ventry.getColumnValues().get(25).toString(); String contactscc = ventry.getColumnValues().get(26).toString(); //get the wsdata as an array ViewEntryCollection vecol = wsview.getAllEntriesByKey(docnum,true); ArrayList<SubReportBeanWSNoSubs> wssubRepList = new ArrayList<SubReportBeanWSNoSubs>(); if(vecol.getCount()>0){ ViewEntry wsventry = vecol.getFirstEntry(); while(wsventry!=null){ String line = wsventry.getColumnValues().get(2).toString();System.out.println("setting wsdata for line "+line); String group1 = wsventry.getColumnValues().get(3).toString();// String group2 = wsventry.getColumnValues().get(4).toString();// String group3 = wsventry.getColumnValues().get(5).toString();// String group4 = wsventry.getColumnValues().get(6).toString();// String qnotes1 = wsventry.getColumnValues().get(8).toString();// String qnotes2 = wsventry.getColumnValues().get(9).toString();// String qnotes3 = wsventry.getColumnValues().get(10).toString();// String qnotes4 = wsventry.getColumnValues().get(11).toString();// String qnotes5 = wsventry.getColumnValues().get(12).toString();// String qnotes6 = wsventry.getColumnValues().get(13).toString();// String qnotes7 = wsventry.getColumnValues().get(14).toString();// String qnotes8 = wsventry.getColumnValues().get(15).toString();// String qnotes9 = wsventry.getColumnValues().get(16).toString();// String qnotes10 = wsventry.getColumnValues().get(17).toString();// String tmpws = wsventry.getColumnValues().get(18).toString();// Double totalquotews = Double.parseDouble(tmpws);// String wsdocnum = wsventry.getColumnValues().get(19).toString();/*System.out.println("- - - checking misc data"); //get the misc data list as an array ArrayList<SubReportBeanMisc> miscsubRepList = new ArrayList<SubReportBeanMisc>(); ViewEntryCollection miscvecol = miscview.getAllEntriesByKey(wsdocnum,true); if(miscvecol.getCount()>0){ ViewEntry miscventry = miscvecol.getFirstEntry(); while(miscventry!=null){System.out.println("getting misc data for line "+line); String miscgroup1 = miscventry.getColumnValues().get(3).toString(); String tmpmisc = miscventry.getColumnValues().get(9).toString(); Double totalquotemisc = Double.parseDouble(tmpmisc); //create a misc bean to store in the misc array SubReportBeanMisc miscsubbean = new SubReportBeanMisc(); miscsubbean.setGroup1(miscgroup1); miscsubbean.setTotalquote(totalquotemisc); miscsubRepList.add(miscsubbean); ViewEntry tmpmiscve = miscvecol.getNextEntry(miscventry); miscventry.recycle(); miscventry = tmpmiscve; } } miscvecol.recycle();*/System.out.println("setting subreportbeanws"); //create a ws bean to store in the base array SubReportBeanWSNoSubs wssubbean = new SubReportBeanWSNoSubs();// wssubbean.setLine(line);// wssubbean.setGroup1(group1); /* wssubbean.setGroup2(group2); wssubbean.setGroup3(group3); wssubbean.setGroup4(group4); wssubbean.setQnotes1(qnotes1); wssubbean.setQnotes2(qnotes2); wssubbean.setQnotes3(qnotes3); wssubbean.setQnotes4(qnotes4); wssubbean.setQnotes5(qnotes5); wssubbean.setQnotes6(qnotes6); wssubbean.setQnotes7(qnotes7); wssubbean.setQnotes8(qnotes8); wssubbean.setQnotes9(qnotes9); wssubbean.setQnotes10(qnotes10); */// wssubbean.setTotalquote(totalquotews);// wssubbean.setWsdocnum(wsdocnum); // wssubbean.setSubReportBeanMiscList(miscsubRepList); wssubRepList.add(wssubbean); ViewEntry tmpve = vecol.getNextEntry(wsventry); wsventry.recycle(); wsventry = tmpve; } vecol.recycle(); } System.out.println("setting databeanlist"); //create the base quote bean array dataBeanList.add(produce(docnum,repquote,custname,custnum,custadd_2,custadd_3,custadd_4,custadd_5,custadd_6,contact,contactemail,contactphone, program,inqnum,fob,terms,estimator,saleseng,expires,qnotes,bottomterms,totalquote,docnumoption,datesentoption,id,draft,contactscc,wssubRepList)); ventry.recycle(); baseview.recycle(); wsview.recycle();// miscview.recycle(); } catch(NotesException e){ System.out.println("Error in DataBeanList: " + e); } return dataBeanList; } /** * This method returns a DataBean object, * with all the fields for the main report in it (and an array for the WS subreport * which contains an array for th misc subreport) */ private DataBeanNoSubs produce(String qnum, String repquote, String custname, String custnum, String custadd_2, String custadd_3, String custadd_4, String custadd_5, String custadd_6, String contact, String contactemail, String contactphone, String program, String inqnum, String fob, String terms, String estimator, String saleseng, String expires, String qnotes, String bottomterms, Double totalquote, String docnumoption, String datesentoption, String id, String draft, String contactscc, List<SubReportBeanWSNoSubs> subBean) { DataBeanNoSubs dataBean = new DataBeanNoSubs(); dataBean.setDocnum(qnum); dataBean.setRepquote(repquote); dataBean.setCustname(custname); dataBean.setCustnum(custnum); dataBean.setCustadd_2(custadd_2); dataBean.setCustadd_3(custadd_3); dataBean.setCustadd_4(custadd_4); dataBean.setCustadd_5(custadd_5); dataBean.setCustadd_6(custadd_6); dataBean.setContact(contact); dataBean.setContactemail(contactemail); dataBean.setContactphone(contactphone); dataBean.setProgram(program); dataBean.setInqnum(inqnum); dataBean.setFob(fob); dataBean.setTerms(terms); dataBean.setEstimator(estimator); dataBean.setSaleseng(saleseng); dataBean.setExpires(expires); dataBean.setQnotes(qnotes); dataBean.setBottomterms(bottomterms); dataBean.setTotalquote(totalquote); dataBean.setDocnumoption(docnumoption); dataBean.setDatesentoption(datesentoption); dataBean.setId(id); dataBean.setDraft(draft); dataBean.setContactscc(contactscc); dataBean.setSubReportBeanWSList(subBean); return dataBean; }} My output on the server log is as follows: 3: var pdf = new com.hsdomino.jasper.CreatePDFNoSubs;-> 4: pdf.reportToFileNoSubs(docnum)javax.faces.FacesException: Error while executing JavaScript action expression at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:102) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96) at com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:256) at com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:227) at com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157) at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:159) at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138) at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103) at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588) at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335) at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:865) at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:808) at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:577) at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319) at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662) at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482) at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357) at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313) at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)Caused by: com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript action expression at com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:126) at com.ibm.xsp.actions.ExecuteScriptAction.invoke(ExecuteScriptAction.java:78) at com.ibm.xsp.application.ActionListenerImpl.processAction(ActionListenerImpl.java:60) at javax.faces.component.UICommand.broadcast(UICommand.java:324) at com.ibm.xsp.component.UIEventHandler.broadcast(UIEventHandler.java:366) at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400) at com.ibm.xsp.component.UIDataIterator.broadcast(UIDataIterator.java:694) at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400) at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400) at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400) at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400) at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400) at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400) at com.ibm.xsp.component.UIViewRootEx.broadcast(UIViewRootEx.java:1535) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:307) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:428) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:94) ... 19 moreCaused by: com.ibm.jscript.InterpretException: Script interpreter error, line=4, col=5: Error calling method 'reportToFileNoSubs(string)' on java class 'com.hsdomino.jasper.CreatePDFNoSubs' at com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:335) at com.ibm.jscript.types.FBSObject.call(FBSObject.java:161) at com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) at com.ibm.jscript.ASTTree.ASTProgram.interpret(ASTProgram.java:119) at com.ibm.jscript.ASTTree.ASTProgram.interpretEx(ASTProgram.java:139) at com.ibm.jscript.JSExpression._interpretExpression(JSExpression.java:435) at com.ibm.jscript.JSExpression.access$1(JSExpression.java:424) at com.ibm.jscript.JSExpression$2.run(JSExpression.java:414) at java.security.AccessController.doPrivileged(AccessController.java:686) at com.ibm.jscript.JSExpression.interpretExpression(JSExpression.java:410) at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:251) at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:234) at com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(JavaScriptInterpreter.java:222) at com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:111) ... 35 moreCaused by: java.lang.RuntimeException: error in CreatePDF: at com.hsdomino.jasper.CreatePDFNoSubs.reportToFileNoSubs(CreatePDFNoSubs.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) at java.lang.reflect.Method.invoke(Method.java:508) at com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:322) ... 48 moreCaused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: new java.lang.Integer(1) at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:874) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:536) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:411) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:386) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2024) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:748) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:580) at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:414) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:121) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:583) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:929) at com.hsdomino.jasper.CreatePDFNoSubs.reportToFileNoSubs(CreatePDFNoSubs.java:59) ... 53 moreCaused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: new java.lang.Integer(1) at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(JREvaluator.java:352) at net.sf.jasperreports.engine.fill.JRCalculator.evaluateEstimated(JRCalculator.java:607) at net.sf.jasperreports.engine.fill.JRCalculator.estimateVariables(JRCalculator.java:208) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1276) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1250) at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1056) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:580) at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:414) at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:736) at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59) at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.lang.Thread.run(Thread.java:785)Caused by: java.lang.IllegalStateException: NotesContext not initialized for the thread at com.ibm.domino.xsp.module.nsf.NotesContext.getCurrent(NotesContext.java:123) at com.ibm.domino.xsp.module.nsf.ModuleClassLoader$DynamicClassLoader.loadClass(ModuleClassLoader.java:416) at java.lang.ClassLoader.loadClass(ClassLoader.java:809) at com.ibm.domino.xsp.module.nsf.ModuleClassLoader.loadClass(ModuleClassLoader.java:209) at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:842) at java.lang.ClassLoader.loadClass(ClassLoader.java:829) at java.lang.ClassLoader.loadClass(ClassLoader.java:809) at HSD_QuoteWS_Java_1494353558580_394739.evaluateEstimated(HSD_QuoteWS_Java_1494353558580_394739:295) at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(JREvaluator.java:338) HHere is the jrxml for the sub-report (now that all the fields have been removed)...<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.0 --><!-- 2017-05-09T16:17:02 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="HSD_QuoteWS_Java" pageWidth="612" pageHeight="792" columnWidth="612" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="8aaed2a5-8bac-4933-9304-27e8846d99e2"> <property name="ireport.zoom" value="2.0"/> <property name="ireport.x" value="307"/> <property name="ireport.y" value="0"/> <parameter name="SubReportMisc" class="java.lang.String" isForPrompting="false"/> <queryString language="SQL"> <![CDATA[]]> </queryString> <background> <band splitType="Stretch"/> </background> <columnHeader> <band height="31" splitType="Stretch"> <rectangle radius="5"> <reportElement mode="Transparent" x="0" y="5" width="562" height="20" uuid="0e552d18-c6c1-4227-9472-5daef19258fd"/> </rectangle> <staticText> <reportElement x="41" y="11" width="54" height="14" uuid="e36f55b6-dc75-4919-a1f3-4697be31d523"/> <textElement> <font size="8"/> </textElement> <text><![CDATA[Description]]></text> </staticText> <staticText> <reportElement x="445" y="11" width="37" height="14" uuid="e36f55b6-dc75-4919-a1f3-4697be31d523"/> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Amount]]></text> </staticText> <staticText> <reportElement x="9" y="11" width="18" height="14" uuid="e36f55b6-dc75-4919-a1f3-4697be31d523"/> <textElement> <font size="8"/> </textElement> <text><![CDATA[Line]]></text> </staticText> </band> </columnHeader> <detail> <band height="26" splitType="Prevent"/> <band height="9"> <line> <reportElement positionType="Float" x="9" y="4" width="389" height="1" uuid="dd1009ff-efad-4dc1-991a-b8daff790e46"/> </line> </band> </detail></jasperReport> This is the jrxml of the main report...<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.0 --><!-- 2017-05-09T16:16:58 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="HSD_Quote_JavaNoSubs" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e93f8f9b-eed3-4c03-ac1e-280ebc6ccd74"> <property name="ireport.zoom" value="2.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="131"/> <parameter name="SubReportMisc" class="java.lang.String" isForPrompting="false"/> <parameter name="SubReportWS" class="java.lang.String" isForPrompting="false"/> <queryString language="SQL"> <![CDATA[]]> </queryString> <field name="docnum" class="java.lang.String"/> <field name="repquote" class="java.lang.String"/> <field name="custname" class="java.lang.String"/> <field name="custnum" class="java.lang.String"/> <field name="custadd_2" class="java.lang.String"/> <field name="custadd_3" class="java.lang.String"/> <field name="custadd_4" class="java.lang.String"/> <field name="custadd_5" class="java.lang.String"/> <field name="custadd_6" class="java.lang.String"/> <field name="contact" class="java.lang.String"/> <field name="contactemail" class="java.lang.String"/> <field name="contactphone" class="java.lang.String"/> <field name="program" class="java.lang.String"/> <field name="inqnum" class="java.lang.String"/> <field name="fob" class="java.lang.String"/> <field name="terms" class="java.lang.String"/> <field name="estimator" class="java.lang.String"/> <field name="saleseng" class="java.lang.String"/> <field name="expires" class="java.lang.String"/> <field name="qnotes" class="java.lang.String"/> <field name="bottomterms" class="java.lang.String"/> <field name="totalquote" class="java.lang.Double"/> <field name="docnumoption" class="java.lang.String"/> <field name="datesentoption" class="java.lang.String"/> <field name="id" class="java.lang.String"/> <field name="draft" class="java.lang.String"/> <field name="contactscc" class="java.lang.String"/> <field name="subReportBeanWSList" class="java.util.List"/> <background> <band height="752" splitType="Stretch"> <image> <reportElement x="26" y="212" width="552" height="406" uuid="617c85fa-8d1b-4a12-b022-832a6dd83a5c"> <printWhenExpression><![CDATA[$F{draft}.equals( "Y" )]]></printWhenExpression> </reportElement> <imageExpression><![CDATA["C:\JReports\draft.gif"]]></imageExpression> </image> </band> </background> <pageHeader> <band height="215" splitType="Stretch"> <staticText> <reportElement x="391" y="18" width="178" height="31" forecolor="#003399" uuid="7587b061-1376-42ce-93d0-a5b6ba2ae6ae"/> <textElement textAlignment="Right"> <font size="20" isBold="true"/> </textElement> <text><![CDATA[QUOTATION]]></text> </staticText> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement x="79" y="198" width="204" height="15" isRemoveLineWhenBlank="true" uuid="0e1186fe-aa6e-4f17-b0e8-8090cfa65b11"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8" isBold="false"/> </textElement> <textFieldExpression><![CDATA[$F{program}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement x="79" y="154" width="204" height="15" isRemoveLineWhenBlank="true" uuid="d485138e-b5fc-4134-81c2-55b872c8cdbe"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{contactemail}]]></textFieldExpression> </textField> <staticText> <reportElement x="144" y="12" width="100" height="15" uuid="5c931d7d-4a48-4a55-b788-ab4a86a9805b"/> <textElement> <font size="8"/> </textElement> <text><![CDATA[O-222 Lake Michigan Drive]]></text> </staticText> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement x="388" y="147" width="170" height="34" isRemoveLineWhenBlank="true" uuid="51e655c6-d0ac-4bbe-9db4-851667a042c4"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{terms}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement x="79" y="143" width="204" height="15" isRemoveLineWhenBlank="true" uuid="eec703a9-d16e-4c3e-82d4-cb93ca92a498"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{contact}]]></textFieldExpression> </textField> <textField pattern=""> <reportElement x="468" y="49" width="100" height="20" uuid="c084dfb9-6d66-4946-839d-2536fda9120c"/> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA[$F{datesentoption}==null?new java.util.Date().toString():$F{datesentoption}]]></textFieldExpression> </textField> <staticText> <reportElement x="304" y="78" width="76" height="20" uuid="5b8a4ff6-824b-43e9-ae1c-527fedba034b"/> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA]></text> </staticText> <textField evaluationTime="Report"> <reportElement x="530" y="1" width="40" height="20" uuid="09f00528-5230-46d9-830d-14730a764f52"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}!= 1]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> <textField> <reportElement x="388" y="75" width="100" height="20" forecolor="#CC0033" uuid="62c74d5f-cc64-4b9c-a4cb-f298d52d7b00"/> <textElement> <font size="12" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{docnumoption}.equals( "N" )?$F{docnum}:$F{docnumoption}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true"> <reportElement x="79" y="78" width="204" height="15" uuid="fb382bc8-803e-43bc-88eb-dc92bc874722"/> <textElement> <font size="8" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{custname}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="388" y="185" width="170" height="15" isRemoveLineWhenBlank="true" uuid="b731fb17-0ee5-42c7-ab00-0b03b83c5d45"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{fob}]]></textFieldExpression> </textField> <staticText> <reportElement x="304" y="147" width="76" height="15" uuid="fcc465db-893b-4711-9d4a-390d87bcdbdc"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Terms:]]></text> </staticText> <staticText> <reportElement x="5" y="198" width="69" height="15" uuid="5248f4f9-528d-4af7-8133-dffccd45a4cf"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Program:]]></text> </staticText> <staticText> <reportElement x="144" y="33" width="100" height="15" uuid="fc790196-8605-43bc-a4d6-5b5f2eb72709"/> <textElement> <font size="8"/> </textElement> <text><![CDATA[Ph (616) 444-5551]]></text> </staticText> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="79" y="88" width="204" height="15" isRemoveLineWhenBlank="true" uuid="1bf65e63-ca78-42d7-aceb-1bf0ec9a8d13"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{custadd_2}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="388" y="122" width="170" height="20" isRemoveLineWhenBlank="true" uuid="41334a0c-697c-48fe-8e46-988182ec6f2f"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{saleseng}]]></textFieldExpression> </textField> <line> <reportElement x="3" y="69" width="571" height="1" uuid="da1fda0a-7176-43eb-9d55-0f1d91223f15"/> </line> <staticText> <reportElement x="144" y="22" width="100" height="15" uuid="9a300a60-fb95-4c90-89ae-409637c4add0"/> <textElement> <font size="8"/> </textElement> <text><![CDATA[Grand Rapids, MI 49534]]></text> </staticText> <textField> <reportElement x="478" y="1" width="80" height="20" uuid="43bf3682-bd0a-457b-8bfa-533d089e0e0e"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}!= 1]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression> </textField> <staticText> <reportElement x="304" y="185" width="76" height="15" uuid="50a5e10e-eb17-4b81-b37d-00c4d3d72832"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[F.O.B.:]]></text> </staticText> <textField isBlankWhenNull="true"> <reportElement x="388" y="198" width="170" height="15" isRemoveLineWhenBlank="true" uuid="cb9b21e4-e61c-4ce3-b515-4f06ba86fa44"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{expires}]]></textFieldExpression> </textField> <staticText> <reportElement x="144" y="54" width="100" height="15" uuid="4025a6ce-a8aa-484b-9c5e-1372d74dd6a5"/> <textElement> <font size="8"/> </textElement> <text><![CDATA[www.abc.com]]></text> </staticText> <staticText> <reportElement x="23" y="143" width="49" height="20" uuid="f771c7be-a93b-42f0-a910-5e098440a9c5"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Attention:]]></text> </staticText> <staticText> <reportElement x="304" y="198" width="76" height="15" uuid="4643dc19-a9c6-4351-a5c7-da735f9b2d59"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Price Firm for:]]></text> </staticText> <staticText> <reportElement x="23" y="78" width="49" height="20" uuid="be7efe87-0a7c-499b-afb3-88d3a0fcf6de"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Customer:]]></text> </staticText> <staticText> <reportElement x="144" y="1" width="111" height="15" uuid="41d52714-c1c7-48a2-aa5d-c3200d54a073"/> <textElement> <font size="8"/> </textElement> <text><![CDATA[ABC Engineering, Inc.]]></text> </staticText> <staticText> <reportElement x="144" y="44" width="100" height="15" uuid="1e84138f-26c4-42a6-a0b5-2a6d6848f67a"/> <textElement> <font size="8"/> </textElement> <text><![CDATA[Fx (616) 453-7872]]></text> </staticText> <staticText> <reportElement x="304" y="122" width="76" height="20" uuid="4da77cda-b405-49d8-a24b-09b450ffbc10"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA]></text> </staticText> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="79" y="98" width="204" height="15" isRemoveLineWhenBlank="true" uuid="f7af1b84-727e-4f95-8836-da3dae5e8791"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{custadd_3}]]></textFieldExpression> </textField> <image> <reportElement x="-4" y="-1" width="139" height="73" uuid="6b423ded-857b-408c-930e-2b07999c44ff"/> <imageExpression><![CDATA["C:\JReports\abc.gif"]]></imageExpression> </image> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="79" y="118" width="204" height="15" isRemoveLineWhenBlank="true" uuid="f7af1b84-727e-4f95-8836-da3dae5e8791"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{custadd_5}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="79" y="108" width="204" height="15" isRemoveLineWhenBlank="true" uuid="1bf65e63-ca78-42d7-aceb-1bf0ec9a8d13"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{custadd_4}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="79" y="128" width="204" height="15" isRemoveLineWhenBlank="true" uuid="f7af1b84-727e-4f95-8836-da3dae5e8791"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{custadd_6}]]></textFieldExpression> </textField> <staticText> <reportElement x="304" y="98" width="76" height="15" isRemoveLineWhenBlank="true" uuid="9362af18-98be-4a8b-9d15-13ea23f9c8e5"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 ) & !$F{repquote}.isEmpty()]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Replaces:]]></text> </staticText> <textField> <reportElement x="388" y="98" width="170" height="15" isRemoveLineWhenBlank="true" uuid="d35402cb-a117-49a9-8e04-ad0dcec83d16"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 ) & !$F{repquote}.isEmpty()]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{repquote}]]></textFieldExpression> </textField> <staticText> <reportElement x="5" y="188" width="69" height="15" uuid="5248f4f9-528d-4af7-8133-dffccd45a4cf"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[inquiry #:]]></text> </staticText> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement x="79" y="188" width="204" height="15" isRemoveLineWhenBlank="true" uuid="0e1186fe-aa6e-4f17-b0e8-8090cfa65b11"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 )]]></printWhenExpression> </reportElement> <textElement> <font size="8" isBold="false"/> </textElement> <textFieldExpression><![CDATA[$F{inqnum}]]></textFieldExpression> </textField> <staticText> <reportElement x="23" y="168" width="49" height="20" uuid="4f31b15b-3685-4102-b91f-ae5aa74afb72"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 ) & !$F{contactscc}.isEmpty()]]></printWhenExpression> </reportElement> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Cc:]]></text> </staticText> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement x="79" y="168" width="204" height="20" isRemoveLineWhenBlank="true" uuid="6c4a2396-8408-4809-a2c7-b4416e44df2f"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.equals( 1 ) & !$F{contactscc}.isEmpty()]]></printWhenExpression> </reportElement> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{contactscc}]]></textFieldExpression> </textField> </band> </pageHeader> <detail> <band height="53" splitType="Stretch"> <subreport> <reportElement stretchType="RelativeToBandHeight" x="3" y="0" width="569" height="51" uuid="d68f71f8-dade-4f9f-949d-c2d3f63d63bd"/> <subreportParameter name="SubReportMisc"> <subreportParameterExpression><![CDATA[$P{SubReportMisc}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{subReportBeanWSList})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SubReportWS}]]></subreportExpression> </subreport> </band> <band height="24" splitType="Prevent"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="13" y="6" width="388" height="15" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="ac1d02a7-481d-4385-aaec-f19a98af92e0"/> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{qnotes}]]></textFieldExpression> </textField> </band> <band height="31"> <staticText> <reportElement positionType="Float" x="282" y="10" width="119" height="15" uuid="dcfdb3a3-bfe0-4285-81ee-00331f905ff7"/> <textElement textAlignment="Right"> <font size="8"/> </textElement> <text><![CDATA[Total Quoted Cost:]]></text> </staticText> <textField pattern="¤ #,##0"> <reportElement positionType="Float" x="406" y="7" width="81" height="20" uuid="3641aa92-28d4-41f0-8613-b352577ebe37"/> <textElement textAlignment="Right"> <font isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{totalquote}]]></textFieldExpression> </textField> </band> </detail> <pageFooter> <band height="56" splitType="Stretch"> <textField evaluationTime="Report"> <reportElement x="537" y="39" width="40" height="15" uuid="d0494f5b-825b-44be-a85a-872cc1cf378e"/> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> <rectangle radius="5"> <reportElement stretchType="RelativeToTallestObject" x="8" y="3" width="572" height="36" uuid="40aac1d3-39af-468f-a98d-f334984c4fbd"/> </rectangle> <staticText> <reportElement x="201" y="39" width="107" height="15" uuid="2166b9c4-29bf-4acc-bc3f-bca53b2cf45a"/> <textElement textAlignment="Right"> <font size="8" isBold="false"/> </textElement> <text><![CDATA[ABC Quote Number:]]></text> </staticText> <textField> <reportElement x="312" y="39" width="80" height="15" forecolor="#000000" uuid="62c74d5f-cc64-4b9c-a4cb-f298d52d7b00"/> <textElement> <font size="8" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{docnumoption}.equals( "N" )?$F{docnum}:$F{docnumoption}]]></textFieldExpression> </textField> <textField pattern=""> <reportElement x="8" y="39" width="85" height="15" uuid="e1693ba6-c836-438e-9638-44ef8a671744"/> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{datesentoption}==null?new java.util.Date().toString():$F{datesentoption}]]></textFieldExpression> </textField> <textField> <reportElement x="457" y="39" width="80" height="15" uuid="d6678dac-fae6-4c9b-bf40-f8f60481603e"/> <textElement textAlignment="Right"> <font size="8"/> </textElement> <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression> </textField> <textField> <reportElement stretchType="RelativeToBandHeight" x="13" y="7" width="562" height="20" uuid="f982027e-c884-412a-b203-849452da7a33"/> <textElement> <font size="8"/> </textElement> <textFieldExpression><![CDATA[$F{bottomterms}]]></textFieldExpression> </textField> <staticText> <reportElement x="103" y="40" width="11" height="12" uuid="9c793d91-f955-42a8-80fa-4be65a6f8fa4"/> <textElement> <font size="6"/> </textElement> <text><![CDATA[iD:]]></text> </staticText> <textField> <reportElement x="114" y="40" width="84" height="12" uuid="2f3cbb8d-2ffc-4f31-bbe8-45182b9222e9"/> <textElement> <font size="6"/> </textElement> <textFieldExpression><![CDATA[$F{id}]]></textFieldExpression> </textField> </band> </pageFooter></jasperReport> I've searched quite a bit but was unable to find any other posts that could help me find the problem, here, so any help would be greatly appreciated.Let me know if I need to provide more information. Link to comment Share on other sites More sharing options...
mkljajic91 Posted November 30, 2017 Share Posted November 30, 2017 Hi @rpozsgai, i have same problem, did you found solution? Link to comment Share on other sites More sharing options...
rpozsgai Posted November 30, 2017 Author Share Posted November 30, 2017 I'm still struggling to get this Java approach to work. But, I think I did figure out the error for NotesContext not initialized. For me, the problem was that I was using the field name directly as my Sub-Report Data Source Expression. However, the proper format for the Data Source Expression is actually...new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{subReportBeanList})In my current project, I was finally able to get one subreport to work. But, in this new case, I have 3 subreports and the second one doesn't want to cooperate. Now, I get a field exception error for java.lang.Integer(1) - which is strange because all my fields are Strings.Hope this helps. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now