Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Use pentaho reporter to transform xml to PDF

  1. #1

    Default Use pentaho reporter to transform xml to PDF

    Hi all

    I would like to know if could be a good idea to use Pentaho Reporter tool CE to

    a) Design a PDF template to fill in
    b) design a system that automatically will pick up XML files from a folder in the server and transform the information in PDF files using the PDF template designed in step a).
    c) I am thinking about qty's of 200.000 to 300.000 xml files to produce other 200.000 to 300.000 PDF files and place the PDF's in a folder in a second server path.

    Would it be possible and the time taken would be reazonable?? What do you think??

    Which version stable do you recomend for this project?

    Thanks a lot

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Use a PDI transformation. It can pick up all files for you, parse them, hand the values over to the reporting engine, and then push the resulting file off to your other server. I assume the reports themselves are fairly small, so each of them would execute in a few seconds. PDI can run in parallel, on as many CPUs as needed, so at that point your number of CPUs limits the time it takes.

    We always recommend the *latest* stable version.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3

    Default

    ´Hi Taqua

    Thanks a lot for the quick answer. Let me check if I understood it right, as my idea was to use only Pentaho Reporting Tool, dont get to see why we need to create a PDI transformation sorry. I mean we use to use PDI transformation to Extranct Transform and Load data from one sourse to another destination.... what you mean is that the destination would be our PDF Report Template?

    How can we get this done? First we design the template in the Report engine and then we can use this template in the Kettle tool as destination of the transformation?

    I would appreciate if you could point us some summarized steps to get a better picture of the best process you are trying to describe, please.

    Thanks a lot once more for your help!!

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Pentaho reportig does not look through a directory to create multiple reports. Pentaho Reporting creates one report per invokation, so someone, somewhere needs to check the directory, needs (at minimum) to read those file names and pass them to the reporting engine. The xml-datasource we have inside the reporting-engine is not very flexible, so unless your data comes in a simple, flat format and can be read from the same file-name, you wont have much joy with it. Of course, you can always use a PDI-datasource to invoke a PDI tranformation to get the data from the report.

    PDI is a tool that reads data from one source and .. well, ... does something with it. It can write it out into a data-warehouse, but it can as well invoke the reporting engine to produce Pdf files. If you think of the reporting run as a "Transform" then it even fits the traditional ETL picture. But PDI is a general data-working tool, and thus can be used for all sorts of batch processes. Filling a data-warehouse is just one of the many things you can do with it.

    Here is how to start:

    First create your report, and define all inputs as parameter. Set sensible default values and you should be able to test the report inside PRD.

    Then in your Kettle-tranformation, read the file names of the source-directory. Use the names to drive an XML-input step to get the data out of the xml files. Pass that data to a Pentaho Reporting Step. That produces a PDF file. The step drops the file in a directory, and gives you the filename as output. From there you can move and rename it into the proper target location.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  5. #5

    Default

    Hi again Taqua

    I think we are almost there. I have followed your instructions creating a pentaho report template in the Report Designer and now I am trying to call it from a Kettle Transformation.

    Pretty much the steps I have followed have been

    a) I have created the pentaho report template adding all the fields I needed to show in the final pdf report as "parameters" (obtained from the xml definition file). I must say that even when I try to run a preview of this report nothing is generated or shown, not even the text labels (dont know if this is normal).

    b) I have created an easy Kettle transformation to read one of the xml files and to try to select the fields we need from this xml and parse it with the pentaho report template mapping the parameters of the report template with the fields readed from the xml file.

    c) In the Pentaho Report Output I have configured correctly the parameters "Report Output" and "Report Template" to use the template we have created to the let Kettle know where it must place the pdf exit file.

    When I click on run, the process ends successfully, however the pdf file generated is 0KB size and of course we can not open it (dont know if this is related with the fact that I am not able to see even the preview of the report template as it contains only parameters).

    If I run a debug in the Pentaho Report Output I can see the parameters correctly assigned with the values of the fields from the XML file.... but seems that they are not placed in the pdf output file...... Any ideas what can I be doing wrong?

    Thanks a lot in advance

  6. #6

    Default

    Dont worry, found the issue. If I remove the "Validate Values" from each of the parameters in the Report Template, it works like a charm!

    Cheers

  7. #7

    Default

    Hi again

    Sorry but we are finding more issues (sure due to our lack of experience using XML in pentaho reporting). Ihave here this simple XML file

    <Service>


    <Number_id>698137757</Number_id>


    <UI>111636</UI>


    <IVA>21</IVA>


    <TipoIVA>1</TipoIVA>


    <Cuota>


    <Descripcion>consumo mínimo</Descripcion>


    <Importe>6,000000</Importe>


    </Cuota>


    <Cuota>


    <Descripcion>cota mensual TipoB</Descripcion>


    <Importe>3,000000</Importe>


    </Cuota>


    </Service>


    <Service>


    <Number_id>687063413</Number_id>


    <UI>111636</UI>


    <IVA>21</IVA>


    <TipoIVA>1</TipoIVA>


    <Cuota>


    <Descripcion>cuota mensual ocio</Descripcion>


    <Importe>6,000000</Importe>


    </Cuota>


    </Service>

    So I need to appear in my report a table like this

    ServiceId Descripcion Importe

    698137757 consumo mínimo 6,00
    698137757 cota mensual TipoB 3,00
    687063413 cuota mensual ocio 6,00


    We are using a set subreports hanging from a parent report.

    In the parent report we have more information, and we call the subreport1 where we get to the <service> level of the xml file

    Next step is to create a subreport2 which is into the subreport1 to get to the <cuota> level. To get this we try to filter the values for each "number_id" value using this xquery in the DataSource. First we import the parameter from the fields returned in the query used in the subreport1 and we call it "Number_id_Parent"

    /Service[Number_id=${Number_id_Parent}]/Cuota

    But this is not returning anything. Any ideas please???

    If we change the query by this

    /Service[Number_id='698137757']/Cuota

    It works fine but for this number_id only.

    I think the problem is in the call to the "imported" parameter from the "parent report of subreport2 (subreport1) called "Number_id_Parent", but I am not sure how to call it correctly to filter the values as we need .

    Thanks a lot
    Last edited by jlabuelo; 07-18-2013 at 09:04 AM.

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.