Jump to content
We've recently updated our Privacy Statement, available here ×

jazebmazher728

Members
  • Posts

    5
  • Joined

  • Last visited

jazebmazher728's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi , I am facing this issue when i am sending custom data through JRBeamDataSource Collection data integrate in php but i am facing this error Warning: argument 'Collection' is not a Java object,using NULL instead in http://localhost:8080/JavaBridgeTemplate721/java/Java.inc on line 511 this is my php code <?php require_once("http://localhost:8080/JavaBridgeTemplate721/java/Java.inc"); require "collection.php"; try { $jasperxml = new java("net.sf.jasperreports.engine.xml.JRXmlLoader"); $jasperDesign = $jasperxml->load(realpath("customer.jrxml")); $compileManager = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager"); $report = $compileManager->compileReport($jasperDesign); } catch (JavaException $ex) { echo $ex; } $fillManager = new JavaClass("net.sf.jasperreports.engine.JasperFillManager"); $array1 = [['debit'=> '20.00','credit'=> '50.00'],['debit'=> '10.00','credit'=> '15.00']]; $arrayList = new java( 'java.util.ArrayList'); foreach($array1 as $key => $a){ $collect1 = new Collection(); $collect1->setDebit($a['debit']); $collect1->setCredit($a['credit']); $arrayList->add($collect1); } //$arrays = ['20.00','30.00','40.00']; $params = new Java("java.util.HashMap"); /* $params->put("debit", "30.00"); $params->put("credit", "3.00"); $params->put("description", "Test123Customer"); $params->put("date", "2019-07-22 06:37:09"); */ $class = new JavaClass("java.lang.Class"); $beanCollection = new Java("net.sf.jasperreports.engine.data.JRBeanCollectionDataSource" , $arrayList); $params->put('DataSource', $beanCollection); $emptyDataSource = new Java("net.sf.jasperreports.engine.JREmptyDataSource"); $jasperPrint = $fillManager->fillReport($report, $params, $emptyDataSource); $exporter = new java("net.sf.jasperreports.engine.JRExporter"); switch ($_POST['format']) { case 'pdf': $outputPath = realpath(".")."/"."output.pdf"; $exportManager = new JavaClass("net.sf.jasperreports.engine.JasperExportManager"); $exportManager->exportReportToPdfFile($jasperPrint, $outputPath); break; } ?> and this is my collection class php <?php class Collection { private $debit; private $credit; public function __construct() { $this->debit = ''; $this->credit = ''; } // getter-setter public function getDebit(){ return $this->debit; } public function setDebit($debit){ $this->debit = $debit; } public function getCredit(){ return $this->credit; } public function setCredit($credit){ $this->credit = $credit; } } ?> thats why i am seeing reporting value is null plz help me how to resolve this issue in php using php/javabridge not java?
  2. Hi, I am facing this issue when i am passing JRBeanCollectionDataSource using php/java bridge then i am see this error: Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke failed: [[c:JasperFillManager]]->fillReport((o:JasperReport)[o:JasperReport], (i:Map)[o:HashMap], (i:JRDataSource)[o:JRBeanCollectionDataSource]). Cause: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $F{debit} VM: 1.8.0_211@http://java.oracle.com/" at: #-26 net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:782) #-25 net.sf.jasperreports.components.table.fill.FillTableSubreport.prepareSubreport(FillTableSubreport.java:156) #-24 net.sf.jasperreports.components.table.fill.FillTable.prepare(FillTable.java:392) #-23 net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:151) #-22 net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331) #-21 net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:384) #-20 net.sf.jasperreports.engine.fil in http://localhost:8080/JavaBridgeTemplate721/java/Java.inc on line 223 here is my php code <?php require_once("http://localhost:8080/JavaBridgeTemplate721/java/Java.inc"); try { $jasperxml = new java("net.sf.jasperreports.engine.xml.JRXmlLoader"); $jasperDesign = $jasperxml->load(realpath("customer.jrxml")); $compileManager = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager"); $report = $compileManager->compileReport($jasperDesign); } catch (JavaException $ex) { echo $ex; } $fillManager = new JavaClass("net.sf.jasperreports.engine.JasperFillManager"); $array1 = ['debit'=>['20.00','30.00']]; $array2 = ['debit'=>['20.00','30.00']]; $array3 = '5.00'; $array4 = '2000.00'; $array5 = '11120.00'; $array6 = '5562.00)'; //$arrays = ['20.00','30.00','40.00']; $params = new Java("java.util.HashMap"); /* $params->put("debit", "30.00"); $params->put("credit", "3.00"); $params->put("description", "Test123Customer"); $params->put("date", "2019-07-22 06:37:09"); */ $arrayList = new java( 'java.util.ArrayList' ); $arrayList->add($array1); $arrayList->add($array2); $class = new JavaClass("java.lang.Class"); $beanCollection = new Java("net.sf.jasperreports.engine.data.JRBeanCollectionDataSource" , $arrayList); $params->put('DataSource', $beanCollection); $emptyDataSource = new Java("net.sf.jasperreports.engine.JREmptyDataSource"); $jasperPrint = $fillManager->fillReport($report, $params, $beanCollection); $exporter = new java("net.sf.jasperreports.engine.JRExporter"); switch ($_POST['format']) { case 'pdf': $outputPath = realpath(".")."/"."output.pdf"; $exportManager = new JavaClass("net.sf.jasperreports.engine.JasperExportManager"); $exportManager->exportReportToPdfFile($jasperPrint, $outputPath); break; } ?> and here is my jrxml code <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.9.0.final using JasperReports Library version 6.9.0-cb8f9004be492ccc537180b49c026951f4220bf3 --> <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="Blank_A4_3" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c2015334-3b9b-48bc-ade2-86e7e520a7f6"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="ItemDataset" uuid="0b152643-cf72-4976-95bc-192345124039"> <queryString> <![CDATA[]]> </queryString> <field name="debit" class="java.lang.Double"/> <field name="credit" class="java.lang.Double"/> </subDataset> <parameter name="DataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/> <queryString> <![CDATA[]]> </queryString> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"> <staticText> <reportElement x="70" y="27" width="390" height="30" uuid="813ea731-a878-48b4-8ab6-40736164657e"/> <text><![CDATA[summary Report]]></text> </staticText> </band> </title> <detail> <band height="261" splitType="Stretch"> <componentElement> <reportElement x="0" y="0" width="555" height="200" uuid="5670f572-47f7-4ce7-b985-1a21c4f029de"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/> <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/> <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/> </reportElement> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="ItemDataset" uuid="4bb2e07a-1d54-4e7c-8ddc-3adfa06cf9dd"> <dataSourceExpression><![CDATA[$P{DataSource}]]></dataSourceExpression> </datasetRun> <jr:column width="100" uuid="80a265a4-dbec-4453-89fd-18f8f7bb2c9b"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/> <jr:tableHeader style="Table_TH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="100" height="30" uuid="adcbdb6c-29c4-401d-8508-c9110a8bfdab"/> <text><![CDATA[Debit]]></text> </staticText> </jr:tableHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="100" height="30" uuid="6e7f26b6-cfd4-49a7-9c5f-cac28274fe12"/> <textFieldExpression><![CDATA[$F{debit}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="100" uuid="2075644c-e62a-4d28-945a-4cb4670a6cc9"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/> <jr:tableHeader style="Table_TH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="100" height="30" uuid="3c7cc499-199b-4490-be8e-1ad19ee7a483"/> <text><![CDATA[Credit]]></text> </staticText> </jr:tableHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="100" height="30" uuid="187fbede-5f3b-40bc-ac1e-b45b3f2acd21"/> <textFieldExpression><![CDATA[$F{credit}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </detail> </jasperReport> plz help me to resolve this issue ????
  3. Hi C-Box, Thanks for reply your answer .I am m using array list type this is working fine but i want to render each row now in one field show array see here this is not good i want to this array show in each row not one row/ https://imgur.com/tKQiENS
  4. Hi im using array list type this is working fine but i want to render each row now in one field show array see here this is not good i want to this array show in each row not one row
  5. Hi I am integrate jasper report using with php/javabridge.I dont need to connect any db or query.I want to passing custom array data but i am facing this error Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke failed: [[c:JasperFillManager]]->fillReport((o:JasperReport)[o:JasperReport], (i:Map)[o:HashMap], (i:JRDataSource)[o:JREmptyDataSource]). Cause: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $P{debit} VM: 1.8.0_211@http://java.oracle.com/" at: #-27 net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:244) #-26 net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591) #-25 net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559) #-24 net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1016) #-23 net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:504) #-22 net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:488) #-21 net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259) #-20 net.sf.jasperreports.engine.fill.J in http://localhost:8080/JavaBridgeTemplate721/java/Java.inc on line 223 Here are my php code <?php require_once("http://localhost:8080/JavaBridgeTemplate721/java/Java.inc"); try { $jasperxml = new java("net.sf.jasperreports.engine.xml.JRXmlLoader"); $jasperDesign = $jasperxml->load(realpath("customer.jrxml")); $compileManager = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager"); $report = $compileManager->compileReport($jasperDesign); } catch (JavaException $ex) { echo $ex; } $fillManager = new JavaClass("net.sf.jasperreports.engine.JasperFillManager"); $arrays = ['20.00','30.00','40.00']; $params = new Java("java.util.HashMap"); $arrayList = new java( 'java.util.ArrayList' ); foreach( $arrays as $value ) { $arrayList->add( $value ); } $params->put('debit', $arrayList ); $class = new JavaClass("java.lang.Class"); $emptyDataSource = new Java("net.sf.jasperreports.engine.JREmptyDataSource"); $jasperPrint = $fillManager->fillReport($report, $params, $emptyDataSource); $exporter = new java("net.sf.jasperreports.engine.JRExporter"); switch ($_POST['format']) { case 'pdf': $outputPath = realpath(".")."/"."output.pdf"; $exportManager = new JavaClass("net.sf.jasperreports.engine.JasperExportManager"); $exportManager->exportReportToPdfFile($jasperPrint, $outputPath); break; } ?> here are my jrxm code <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.9.0.final using JasperReports Library version 6.9.0-cb8f9004be492ccc537180b49c026951f4220bf3 --> <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="Blank_A4_2" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b16306ac-31b9-44da-8668-5e30125e39b5"> <!--<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>--> <parameter name="date" isForPrompting="true" class="java.lang.String" /> <parameter name="description" isForPrompting="true" class="java.lang.String"/> <parameter name="debit" isForPrompting="true" class="java.lang.String"/> <parameter name="credit" isForPrompting="true" class="java.lang.String"/> <queryString> <![CDATA[]]> </queryString> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"> <staticText> <reportElement x="160" y="0" width="220" height="79" uuid="bdd04fd6-61f1-44e5-be90-0be4df3ace29"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="24"/> </textElement> <text><![CDATA[summary Report]]></text> </staticText> </band> </title> <columnHeader> <band height="75" splitType="Stretch"> <staticText> <reportElement x="80" y="0" width="100" height="75" forecolor="#000000" backcolor="#62B352" uuid="86946ecb-2c90-429c-9bcf-a8713ae0c504"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="18"/> </textElement> <text><![CDATA[date]]></text> </staticText> <staticText> <reportElement x="180" y="0" width="100" height="75" backcolor="#62B352" uuid="391076d7-c81c-4b70-91c0-7d5196c7f544"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="18"/> </textElement> <text><![CDATA[description]]></text> </staticText> <staticText> <reportElement x="280" y="0" width="100" height="75" backcolor="#62B352" uuid="f3c646d6-c0ce-462d-a3d9-b44ca66eb9e6"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="18"/> </textElement> <text><![CDATA[debit]]></text> </staticText> <staticText> <reportElement x="380" y="0" width="100" height="75" backcolor="#62B352" uuid="e5f7e93f-a0c7-45c3-9cba-764aa643c30d"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="18"/> </textElement> <text><![CDATA[credit]]></text> </staticText> </band> </columnHeader> <detail> <band height="125" splitType="Stretch"> <textField> <reportElement x="80" y="47" width="100" height="30" uuid="04732a7a-afaf-4685-a1d2-17a823ebf2a3"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$P{date}]]></textFieldExpression> </textField> <textField> <reportElement x="180" y="47" width="100" height="30" uuid="095d35f9-6a51-413f-8b16-ca8970a1885f"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$P{description}]]></textFieldExpression> </textField> <textField> <reportElement x="280" y="47" width="100" height="30" uuid="567faea4-f51b-4957-bfcb-d69402d455e2"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$P{debit}]]></textFieldExpression> </textField> <textField> <reportElement x="380" y="47" width="100" height="30" uuid="9e5ae1d6-52d7-4b2c-a3e1-04540a101fbd"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$P{credit}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary> </jasperReport> Plz help me this issue ???
×
×
  • Create New...