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

harshchauhan

Members
  • Posts

    1
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by harshchauhan

  1. hi, i'm a new bie to jasper reports after searching a lot on passing a parameter from java to query string in report, i could not make my report run as i intend to. i'm passing a parameter Map parameter= new HashMap(); parameter.put("vrno",vrno); // here vrno is the value that i'm fetching from the text field. // SHOW THE REPORT public void showReport(){ try{ // PREPARING DATABASE CONNECTION Connection con = jb.getConnection(); System.out.println("parameter in ireport = "+vrno+(String)parameter.get("vrno")); File file = new File(FULLPATH+reportName+".jrxml"); // File file = new File(FULLPATH+reportName+".jasper"); System.out.println("file.exists ="+file.exists()); InputStream is = new BufferedInputStream(new FileInputStream(file.getAbsolutePath())); JasperDesign jasperDesign=JRXmlLoader.load(file.getAbsolutePath()); JasperReport jr = JasperCompileManager.compileReport(jasperDesign); // FILL THE REPORT JPrint=JasperFillManager.fillReport(jr, parameter, con); // PRINT REPORT TO PDF FILE. if(TASK_PDF.equalsIgnoreCase(task)) { OutputStream output = new FileOutputStream(new File("d:/"+reportName+".pdf")); JasperExportManager.exportReportToPdfStream(JPrint, output); System.exit(0); } // VIEW THE REPORT JasperViewer.viewReport(JPrint); in my jrxml file the parameter element is <parameter name="vrno" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[new String("PP08Y-00002")]]></defaultValueExpression> </parameter> and my query string is select * from order_head WHERE ORDER_HEAD.VRNO='$P!{vrno}' ---------------------------------------------- 1 when i'm using a hard coded vrno(PP08Y-00001) AT $P!{vrno}, the report runs fine but when i use the parameter string the message displays --- the document has no page... please help...
×
×
  • Create New...