Monday, 10 October 2016

XML : how to set php parameter in jasper report

how to set php parameter in jasper report

dear all need help php parameter in jasper report i want make some report with jasper report and php. i want that's query in jasper report from some value in PHP. for the next step i want make dynamic.

jrxml

  <parameter name="parameter1" class="java.lang.String"/>      <queryString>          <![CDATA[select merk, type, tahun from tbl_mobil where merk =$P{parameter1}]]>      </queryString>    

and the php code

  <?php  error_reporting(0);  /*    * To change this template, choose Tools | Templates   * and open the template in the editor.   */  include_once('phpjasperxml_0.9d/class/tcpdf/tcpdf.php');  include_once("phpjasperxml_0.9d/class/PHPJasperXML.inc.php");  include_once ('phpjasperxml_0.9d/setting.php');    $server = "localhost";  $user = "root";  $pass = "";  $db = "mobil";  $nilai ="Honda";        $PHPJasperXML = new PHPJasperXML();  //$PHPJasperXML->debugsql=true;  $PHPJasperXML->arrayParameter=array("parameter1"=>$nilai);  $PHPJasperXML->load_xml_file("sandi.jrxml");    $PHPJasperXML->transferDBtoArray($server,$user,$pass,$db);  $PHPJasperXML->outpage("I");    //page output method I:standard output  D:Download file      ?>    

and the result like this enter image description here

No comments:

Post a Comment