0
votes
<?xml version="1.0" encoding="UTF-8"?>
<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="null" language="groovy" pageWidth="555" pageHeight="802" columnWidth="535" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="4532cff6-e5b8-4edf-9ab5-46106eff9c86">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <style name="Title" fontName="Times New Roman" fontSize="50" isBold="true" pdfFontName="Times-Bold"/>
    <style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/>
    <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
    <style name="Detail" fontName="Arial" fontSize="12"/>
    <style name="Row" mode="Transparent">
        <conditionalStyle>
            <conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
            <style backcolor="#E6DAC3"/>
        </conditionalStyle>
    </style>
    <parameter name="START_DATE_MAIN" class="java.lang.String"/>
    <parameter name="END_DATE_MAIN" class="java.lang.String"/>
    <parameter name="HOSPITAL_NAME_MAIN" class="java.lang.String"/>
    <parameter name="BRANCH_NAME_MAIN" class="java.lang.String"/>
    <parameter name="START_DATE" class="java.util.Date" isForPrompting="false">
        <defaultValueExpression><![CDATA[(new SimpleDateFormat("dd.MM.yyyy")).parse($P{START_DATE_MAIN})]]></defaultValueExpression>
    </parameter>
    <parameter name="END_DATE" class="java.util.Date" isForPrompting="false">
        <defaultValueExpression><![CDATA[(new SimpleDateFormat("dd.MM.yyyy")).parse($P{END_DATE_MAIN})]]></defaultValueExpression>
    </parameter>
    <parameter name="HOSPITAL_NAME_SUB" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA[$P{HOSPITAL_NAME_MAIN}]]></defaultValueExpression>
    </parameter>
    <parameter name="BRANCH_NAME_SUB" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA[$P{BRANCH_NAME_MAIN}]]></defaultValueExpression>
    </parameter>
    <queryString>
        <![CDATA[SELECT DISTINCT wet.wkf_ebp_document_serial, wet.document_title, wet.document_name, sb.branch_name
FROM wkf_ebp_table wet
  INNER JOIN wkf_ebp_registry_files werf ON werf.wkf_ebp_document_serial = wet.wkf_ebp_document_serial
  INNER JOIN system_branches sb ON wet.system_branch_serial = sb.system_branch_serial
WHERE wet.wkf_ebp_document_serial = 54
ORDER BY wet.wkf_ebp_document_serial]]>
    </queryString>
    <field name="wkf_ebp_document_serial" class="java.lang.Integer"/>
    <field name="document_title" class="java.lang.String"/>
    <field name="document_name" class="java.lang.String"/>
    <field name="branch_name" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="57">
            <subreport>
                <reportElement x="0" y="0" width="555" height="50" uuid="44cb07e6-92a3-4d07-ad6b-0cdb29bcfca2"/>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA["Z:\\NGenXEHMISReports\\src\\com\\ngenx\\universals\\NhifHeader\\PortraitNhifHeader.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </title>
    <columnHeader>
        <band height="53">
            <subreport>
                <reportElement x="0" y="0" width="555" height="50" uuid="9e9faae4-5f9b-4be8-b2de-dbe88eeb064e"/>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA["Z:\\NGenXEHMISReports\\src\\com\\ngenx\\EHMIS\\Reports\\BpmBatchClaimsListClaimsAndRegFiles\\BpmBatchClaimsListClaimsAndRegFilesTitle.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </columnHeader>
    <detail>
        <band height="84">
            <subreport>
                <reportElement x="0" y="0" width="555" height="81" uuid="72299e64-b064-45c9-be5c-230178ebbdb2"/>
                <subreportParameter name="END_DATE_MAIN">
                    <subreportParameterExpression><![CDATA[$P{END_DATE_MAIN}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="BRANCH_NAME_MAIN">
                    <subreportParameterExpression><![CDATA[$P{BRANCH_NAME_MAIN}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="HOSPITAL_NAME_SUB">
                    <subreportParameterExpression><![CDATA[$P{HOSPITAL_NAME_SUB}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="HOSPITAL_NAME_MAIN">
                    <subreportParameterExpression><![CDATA[$P{HOSPITAL_NAME_MAIN}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="END_DATE">
                    <subreportParameterExpression><![CDATA[$P{END_DATE}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="START_DATE">
                    <subreportParameterExpression><![CDATA[$P{START_DATE}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="START_DATE_MAIN">
                    <subreportParameterExpression><![CDATA[$P{START_DATE_MAIN}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="BRANCH_NAME_SUB">
                    <subreportParameterExpression><![CDATA[$P{BRANCH_NAME_SUB}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA["Z:\\NGenXEHMISReports\\src\\com\\ngenx\\EHMIS\\Reports\\BpmBatchClaimsListClaimsAndRegFiles\\BpmBatchClaimsListClaimsAndRegFilesBatchList.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="97"/>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch">
            <line>
                <reportElement positionType="FixRelativeToBottom" x="0" y="3" width="555" height="1" uuid="f5f84792-ead7-447c-8611-c102cb7bcdca"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#999999"/>
                </graphicElement>
            </line>
        </band>
    </columnFooter>
    <pageFooter>
        <band height="25" splitType="Stretch">
            <frame>
                <reportElement mode="Opaque" x="-21" y="1" width="597" height="24" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="7c8434c0-a6d0-40be-b9f6-a8fe03160e43"/>
                <textField evaluationTime="Report">
                    <reportElement style="Column header" x="533" y="0" width="40" height="20" forecolor="#736343" uuid="546e557a-42eb-43e0-bc8c-00331c199a50"/>
                    <textElement verticalAlignment="Middle">
                        <font size="10" isBold="false"/>
                    </textElement>
                    <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement style="Column header" x="453" y="0" width="80" height="20" forecolor="#736343" uuid="db70de02-3ac8-4cf4-bfbd-88442962408b"/>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font size="10" isBold="false"/>
                    </textElement>
                    <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
                </textField>
                <textField pattern="EEEEE dd MMMMM yyyy">
                    <reportElement style="Column header" x="22" y="1" width="197" height="20" forecolor="#736343" uuid="53a03810-2c65-4292-849b-38e3cd343cc6"/>
                    <textElement verticalAlignment="Middle">
                        <font size="10" isBold="false"/>
                    </textElement>
                    <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
                </textField>
            </frame>
        </band>
    </pageFooter>
</jasperReport>

Am getting the following error (Error filling print) when i pass four parameter for the above jasper ireport. The SQL query itself is working, But no data is displayed when i run the report on netbeans IDE. It was working before i added hospital and branch parameters . At the time i had only two parameters start date and end date. Any one who could spot the problem ?

Error filling print... net.sf.jasperreports.engine.JRException: Error preparing statement for executing the report query :  SELECT DISTINCT wet.wkf_ebp_document_serial, Count(werf.wkf_ebp_registry_file_serial) AS reg, sb.branch_name,   ncb.batch_title, ncb.nhif_claims_batch_serial, Count(ncbn.nhif_claims_notification_serial) AS claimsnotificationcount,   ncb.total_applied_amount, ncb.total_approved_amount, ncb.total_bill_amount, nhif_hospitals.hospital_name,   wet.document_name, ncb.batch_from_date, ncb.batch_to_date, nhif_claims_notifications.date_added FROM wkf_ebp_table wet   INNER JOIN wkf_ebp_registry_files werf ON werf.wkf_ebp_document_serial = wet.wkf_ebp_document_serial   INNER JOIN system_branches sb ON wet.system_branch_serial = sb.system_branch_serial   INNER JOIN nhif_claims_batches ncb ON ncb.nhif_claims_batch_serial = wet.nhif_claims_batch_serial   INNER JOIN nhif_claims_batch_notifications ncbn ON ncbn.nhif_claims_batch_serial = ncb.nhif_claims_batch_serial   INNER JOIN nhif_hospitals ON nhif_hospitals.system_branch_serial = sb.system_branch_serial AND     ncb.nhif_hospital_serial = nhif_hospitals.nhif_hospital_serial   INNER JOIN nhif_claims_notifications ON     ncbn.nhif_claims_notification_serial = nhif_claims_notifications.nhif_claims_notification_serial WHERE (nhif_claims_notifications.date_added BETWEEN ? AND ? AND nhif_hospitals.hospital_name LIKE   '%?%') OR (sb.branch_name LIKE '%?%') GROUP BY wet.wkf_ebp_document_serial, sb.branch_name, ncb.batch_title, ncb.nhif_claims_batch_serial,   ncb.total_applied_amount, ncb.total_approved_amount, ncb.total_bill_amount, nhif_hospitals.hospital_name,   wet.document_name, ncb.batch_from_date, ncb.batch_to_date, nhif_claims_notifications.date_added ORDER BY wet.wkf_ebp_document_serial
net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error preparing statement for executing the report query :  SELECT DISTINCT wet.wkf_ebp_document_serial, Count(werf.wkf_ebp_registry_file_serial) AS reg, sb.branch_name,   ncb.batch_title, ncb.nhif_claims_batch_serial, Count(ncbn.nhif_claims_notification_serial) AS claimsnotificationcount,   ncb.total_applied_amount, ncb.total_approved_amount, ncb.total_bill_amount, nhif_hospitals.hospital_name,   wet.document_name, ncb.batch_from_date, ncb.batch_to_date, nhif_claims_notifications.date_added FROM wkf_ebp_table wet   INNER JOIN wkf_ebp_registry_files werf ON werf.wkf_ebp_document_serial = wet.wkf_ebp_document_serial   INNER JOIN system_branches sb ON wet.system_branch_serial = sb.system_branch_serial   INNER JOIN nhif_claims_batches ncb ON ncb.nhif_claims_batch_serial = wet.nhif_claims_batch_serial   INNER JOIN nhif_claims_batch_notifications ncbn ON ncbn.nhif_claims_batch_serial = ncb.nhif_claims_batch_serial   INNER JOIN nhif_hospitals ON nhif_hospitals.system_branch_serial = sb.system_branch_serial AND     ncb.nhif_hospital_serial = nhif_hospitals.nhif_hospital_serial   INNER JOIN nhif_claims_notifications ON     ncbn.nhif_claims_notification_serial = nhif_claims_notifications.nhif_claims_notification_serial WHERE (nhif_claims_notifications.date_added BETWEEN ? AND ? AND nhif_hospitals.hospital_name LIKE   '%?%') OR (sb.branch_name LIKE '%?%') GROUP BY wet.wkf_ebp_document_serial, sb.branch_name, ncb.batch_title, ncb.nhif_claims_batch_serial,   ncb.total_applied_amount, ncb.total_approved_amount, ncb.total_bill_amount, nhif_hospitals.hospital_name,   wet.document_name, ncb.batch_from_date, ncb.batch_to_date, nhif_claims_notifications.date_added ORDER BY wet.wkf_ebp_document_serial       at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:782)      at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331)      at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:384)      at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:358)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2059)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:778)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:932)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:87)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)      at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)      at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)  Caused by: net.sf.jasperreports.engine.JRException: Error preparing statement for executing the report query :  SELECT DISTINCT wet.wkf_ebp_document_serial, Count(werf.wkf_ebp_registry_file_serial) AS reg, sb.branch_name,   ncb.batch_title, ncb.nhif_claims_batch_serial, Count(ncbn.nhif_claims_notification_serial) AS claimsnotificationcount,   ncb.total_applied_amount, ncb.total_approved_amount, ncb.total_bill_amount, nhif_hospitals.hospital_name,   wet.document_name, ncb.batch_from_date, ncb.batch_to_date, nhif_claims_notifications.date_added FROM wkf_ebp_table wet   INNER JOIN wkf_ebp_registry_files werf ON werf.wkf_ebp_document_serial = wet.wkf_ebp_document_serial   INNER JOIN system_branches sb ON wet.system_branch_serial = sb.system_branch_serial   INNER JOIN nhif_claims_batches ncb ON ncb.nhif_claims_batch_serial = wet.nhif_claims_batch_serial   INNER JOIN nhif_claims_batch_notifications ncbn ON ncbn.nhif_claims_batch_serial = ncb.nhif_claims_batch_serial   INNER JOIN nhif_hospitals ON nhif_hospitals.system_branch_serial = sb.system_branch_serial AND     ncb.nhif_hospital_serial = nhif_hospitals.nhif_hospital_serial   INNER JOIN nhif_claims_notifications ON     ncbn.nhif_claims_notification_serial = nhif_claims_notifications.nhif_claims_notification_serial WHERE (nhif_claims_notifications.date_added BETWEEN ? AND ? AND nhif_hospitals.hospital_name LIKE   '%?%') OR (sb.branch_name LIKE '%?%') GROUP BY wet.wkf_ebp_document_serial, sb.branch_name, ncb.batch_title, ncb.nhif_claims_batch_serial,   ncb.total_applied_amount, ncb.total_approved_amount, ncb.total_bill_amount, nhif_hospitals.hospital_name,   wet.document_name, ncb.batch_from_date, ncb.batch_to_date, nhif_claims_notifications.date_added ORDER BY wet.wkf_ebp_document_serial       at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createStatement(JRJdbcQueryExecuter.java:372)      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:196)      at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1112)      at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:689)      at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1281)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:900)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)      at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:651)      at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)      at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:203)      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)      at java.lang.Thread.run(Thread.java:748)  Caused by: org.postgresql.util.PSQLException: The column index is out of range: 3, number of columns: 2.      at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:64)      at org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:127)      at org.postgresql.jdbc.PgPreparedStatement.bindString(PgPreparedStatement.java:1110)      at org.postgresql.jdbc.PgPreparedStatement.setString(PgPreparedStatement.java:381)      at org.postgresql.jdbc.PgPreparedStatement.setString(PgPreparedStatement.java:365)      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setStatementParameter(JRJdbcQueryExecuter.java:564)      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setStatementParameter(JRJdbcQueryExecuter.java:399)      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter$1.visit(JRJdbcQueryExecuter.java:332)      at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter$QueryParameter.accept(JRAbstractQueryExecuter.java:157)      at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.visitQueryParameters(JRAbstractQueryExecuter.java:646)      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createStatement(JRJdbcQueryExecuter.java:317)      ... 12 more  Print not filled. Try to use an EmptyDataSource...

1

1 Answers

0
votes

The problem was on string parameter i added ! between $ and P like '%$P!{BRANCH_NAME_SUB}%'

SELECT DISTINCT wet.wkf_ebp_document_serial, Count(werf.wkf_ebp_registry_file_serial) AS reg, sb.branch_name,
  ncb.batch_title, ncb.nhif_claims_batch_serial, Count(ncbn.nhif_claims_notification_serial) AS claimsnotificationcount,
  ncb.total_applied_amount, ncb.total_approved_amount, ncb.total_bill_amount, nhif_hospitals.hospital_name,
  wet.document_name, ncb.batch_from_date, ncb.batch_to_date, nhif_claims_notifications.date_added
FROM wkf_ebp_table wet
  INNER JOIN wkf_ebp_registry_files werf ON werf.wkf_ebp_document_serial = wet.wkf_ebp_document_serial
  INNER JOIN system_branches sb ON wet.system_branch_serial = sb.system_branch_serial
  INNER JOIN nhif_claims_batches ncb ON ncb.nhif_claims_batch_serial = wet.nhif_claims_batch_serial
  INNER JOIN nhif_claims_batch_notifications ncbn ON ncbn.nhif_claims_batch_serial = ncb.nhif_claims_batch_serial
  INNER JOIN nhif_hospitals ON nhif_hospitals.system_branch_serial = sb.system_branch_serial AND
    ncb.nhif_hospital_serial = nhif_hospitals.nhif_hospital_serial
  INNER JOIN nhif_claims_notifications ON
    ncbn.nhif_claims_notification_serial = nhif_claims_notifications.nhif_claims_notification_serial
WHERE (nhif_claims_notifications.date_added BETWEEN $P{START_DATE} AND $P{END_DATE} AND nhif_hospitals.hospital_name LIKE
  '%$P!{HOSPITAL_NAME_SUB}%') OR (sb.branch_name LIKE '%$P!{BRANCH_NAME_SUB}%')
GROUP BY wet.wkf_ebp_document_serial, sb.branch_name, ncb.batch_title, ncb.nhif_claims_batch_serial,
  ncb.total_applied_amount, ncb.total_approved_amount, ncb.total_bill_amount, nhif_hospitals.hospital_name,
  wet.document_name, ncb.batch_from_date, ncb.batch_to_date, nhif_claims_notifications.date_added
ORDER BY wet.wkf_ebp_document_serial