Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Embeded Pentaho Reports with parament on java application

  1. #1
    Join Date
    Apr 2016
    Posts
    16

    Default Embeded Pentaho Reports with parament on java application

    Hi ,All
    i am asking your help for embeding PRPT Report with Parament . and i am very appreaciate if you can give some advice.

    i designered a report using pentaho report designer , and can see the drop down parament ahead of the report content . but it disappear if embeded on java application and no error message appear on tomcat console. also i have added all the pentaho jar file to build path and lib .

    i unzip the prpt file and found a datadefinition.xml file which declare parament list :
    <data-definition xmlns="http://reporting.pentaho.org/namespaces/engine/classic/bundle/data/1.0">
    <parameter-definition>
    <list-parameter name="CustomerNo" allow-multi-selection="false" strict-values="true" mandatory="false" type="java.lang.Integer" query="CustomerList" key-column="CUSTOMERNUMBER" value-column="CUSTOMERNAME" default-value="333">
    <attribute namespace="http://reporting.pentaho.org/namespaces/engine/parameter-attributes/core" name="role">user</attribute>
    <attribute namespace="http://reporting.pentaho.org/namespaces/engine/parameter-attributes/core" name="parameter-render-type">dropdown</attribute>
    <attribute namespace="http://reporting.pentaho.org/namespaces/engine/parameter-attributes/core" name="label">Select Customer</attribute>
    <attribute namespace="http://reporting.pentaho.org/namespaces/engine/parameter-attributes/core" name="mandatory">true</attribute>
    </list-parameter>
    <list-parameter name="Report Type" allow-multi-selection="false" strict-values="true" mandatory="false" type="java.lang.String" query="StatusList" key-column="Value" value-column="ID" default-value="Review">
    <attribute namespace="http://reporting.pentaho.org/namespaces/engine/parameter-attributes/core" name="role">user</attribute>
    <attribute namespace="http://reporting.pentaho.org/namespaces/engine/parameter-attributes/core" name="parameter-render-type">dropdown</attribute>
    <attribute namespace="http://reporting.pentaho.org/namespaces/engine/parameter-attributes/core" name="label">Report Stamp: </attribute>
    <attribute namespace="http://reporting.pentaho.org/namespaces/engine/parameter-attributes/core" name="mandatory">true</attribute>
    </list-parameter>


    servlet code :
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    //response.getWriter().append("Served at: ").append(request.getContextPath());
    //TODO:Handle Pentaho Report Request
    try
    {
    //TODO:load report

    ResourceManager manager=new ResourceManager();
    manager.registerDefaults();
    String reportPath="file:"+this.getServletContext().getRealPath("data/Advanced JDBC Data Source.prpt");

    Resource res=manager.createDirectly(new URL(reportPath), MasterReport.class);
    MasterReport report=(MasterReport) res.getResource();

    for(int i=0;i<report.getElementCount();i++)
    {
    System.out.println("Element"+report.getElement(i));

    }

    System.out.print(report.getParameterValues());
    //TODO:render the pdf file

    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());
    /* response.setContentType("application/rtf");
    response.setHeader("Content-Disposition","attachment; filename=\"Area Chart by Line.rtf\"");
    RTFReportUtil.createRTF(report, response.getOutputStream());*/

    }
    catch(ResourceLoadingException | ResourceCreationException | ResourceKeyCreationException e)
    {
    e.printStackTrace();

    } catch (ResourceException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }


    }

  2. #2
    Join Date
    Apr 2016
    Posts
    16

    Default

    how can i show the parament on my java application , and also i found another issue on this , if my query is depended on the parament , My Java application can't parse this query including parament .How can i do ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.