Hitachi Vantara Pentaho Community Wiki
Child pages
  • 04. Integrating Pentaho Reports (JFreeReports)
Skip to end of metadata
Go to start of metadata

For a more documentation on using JFreeReport with the Pentaho Platform please see Report Design Wizard

JFreeReport Report Definitions

JFreeReport report definitions are XML documents typically with a .xml extension, although this is not necessary. The Pentaho JFreeReportComponent (org.pentaho.plugin.jfree.JFReeReportComponent) uses the report definitions along with your data to produce a comprehensive set of output formats. The JFreeReport output formats worth noting are HTML, PDF, CSV, XLS and RTF.

JFreeReport gets its data from a Java TableModel. There is a custom TableModel implementation in the Pentaho Platform which provides for a memory friendly and performance efficient operation. Since JFreeReport operates against a definition and a TableModel there is no way to parameterize the JFreeReport itself. This is accomplished in the action-sequence and in the query itself.

Using the Pentaho Report Design Wizard you can create a JFreeReport definition and a basic action sequence. In the most simple case create a report against a <Blank> template and enter a SQL query against your database.

The screenshot above shows a parameterized SQL query for use with the Report Design Wizard. The column 'REGION' is what we are using for our parameter. The name of the parameter is also 'REGION' but this is not necessary. The wizard does not currently have the ability to prompt the user for parameter values, so a default value of 'Eastern' has been supplied. The full parameter is specified as {REGION=Eastern} in the query.

When the report is previewed in the Report Design Wizard the REGION parameter value is replaced with the specified default value (Eastern). When the report is published for use in the Pentaho platform the REGION parameter is setup in the action-sequence and the user will be prompted to enter a value. The action-sequence generated by the Report Design Wizard can be further customized by the Pentaho Design Studio.

Creating the Action Sequence

Once you have verified that the report works in the Report Design Wizard you can rest assured that it will work in the Pentaho Platform. The reason for this is that the Report Design Wizard runs the report in an embedded standalone version of the Pentaho Platform. There is no need to create an action-sequence since once is generated automatically by the wizard. However, should you have an existing JFreeReport definition that was created by hand or from another tool. To see an example of an action sequence that generates a JFree report using report parameters refer to pentaho_demo/pentaho_solutions/samples/bursting/BurstActionSequence.xaction. Select the Define Process tab and select the JFree Report action in the Process actions tree.

JDBC Driver Setup

If you are using a database driver other than Hypersonic you'll need to configure the JBoss PCI to use that driver.

TODO

add the JDBC setup. We should have an generic JDBC setup doc that the components all like to

Verifying JFreeReport Integration into Pentaho Platform

At this point the report should be plugged in and ready for use. Point your web browser to your PCI (typically http://localhost:8080). Navigate to the report that you created under the Reporting Examples group.

When you hit the URL for the report a default parameter page is generated prompting you for an input to the parameter for REGION.

Once you submit the parameter the report will be generated and depending on the output-type in the action-sequence you'll see your report in the format desired. The example above shows an HTML screenshot.

The Report Design Wizard

The Pentaho Report Design Wizard provides for quick and easy creation of JFree reports using a simple step-by-step process, that allows for editing of the most commonly used report formatting features. The design wizard is the easiest way to quickly develop customized JFree reports. The wizard is available both as a stand alone application as well as an editor built into the Pentaho Design Studio. For a detailed description of how to use the wizard refer to the Report Design Wizard User's Guide.

Creating a Design Wizard Specification

Select the Pentaho Design Studio icon and choose "New JFree Report Wizard File". Then select the Container Browse button, and choose the "reporting" folder in the PCI then select OK. Now give your new action sequence a name. You're now ready to design your report. If you're new to the Report Design Wizard, you can work through the example in the Report Design Wizard User's Guide. You'll want to skip the step titled "Deploying Reports into Pentaho BI Platform". When your design is complete make sure to save your new report specification.

Using a Design Wizard Specification

Once you've designed your report wizard specification it's time to integrate it into an action sequence that will allow it to run as part of the installed solution. Using the same process we described earlier, create a new blank action sequence in the "reporting" directory of your solution. Assign title, icon, and brief description to your new action sequence to assist you in finding it when we test our action sequence. Select the define process tab then right-click in the Process Actions tree area and select Add->Report->JFree Report. Now select the Browse link on the right side of the page. In the file chooser dialog select the Report Wizard Spec (*.xreportspec) file type then select the wizard specification you created above and select Open. Now save your new action sequence and your ready to go. It's that simple. Use your favorite browser and go to the reporting examples within the PCI. You should see a new entry for the new action sequence you've created. Go ahead and select it and your report should display.

  • No labels

5 Comments

  1. Anonymous

    Hi, my name is Matias and i need to use parameters in my reports.

    In Pentaho Report Wizard i use this query and it works ok

    SELECT
              "VHST_TRANSACCION"."PROCOD" AS VHST_TRANSACCION_PROCOD, count
    FROM    "DBO"."VHST_TRANSACCION" VHST_TRANSACCION
    WHERE     "VHST_TRANSACCION"."TRXFPET" > '

    Unknown macro: {"VHST_TRANSACCION"."TRXFPET"=2006-05-02 00}

    '
     AND "VHST_TRANSACCION"."TRXFPET" < '2006-05-02 23:59:59'
    group by "VHST_TRANSACCION"."PROCOD"

    but when i run it from Pentaho Portal, it shows this error: if i don´t use parameters

    Unknown macro: {"VHST_TRANSACCION"."TRXFPET"=2006-05-02 00}

    i haven´t any problem.

    Failed

    ---- |

    [es_161] Error: [es_385] The solution document samples\reporting\transacciones.xaction is not a valid XML document (org.pentaho.repository.filebased.solution.SolutionRepository) [es_116] Debug: [es_21] Starting execute of samples/reporting/transacciones.xaction (org.pentaho.core.solution.SolutionEngine)
    [es_116] Debug: [es_30] Getting runtime context and data (org.pentaho.core.solution.SolutionEngine)
    [es_116] Debug: [es_33] Loading action sequence definition file (org.pentaho.core.solution.SolutionEngine)
    [es_116] Debug: SolutionRepository.DEBUG_FILE_PATH - [es_35] getFile path=C:\pentaho_demo-1.2.0.534-GA\pentaho-solutions\samples\reporting\transacciones.xaction (org.pentaho.repository.filebased.solution.SolutionRepository)
    [es_161] Error: [es_385] The solution document samples\reporting\transacciones.xaction is not a valid XML document (org.pentaho.repository.filebased.solution.SolutionRepository)
    [es_161] Error: SolutionEngine.ERROR_0005 - [es_29] Action sequence not found (org.pentaho.core.solution.SolutionEngine)

      [es_41] Server Version 1.2.0 build 534 GA

    I wish someone could help me.

     Thanks!

    Matías

  2. Anonymous

    This thing is driving me crazy too..

  3. Anonymous


    *.xaction Define Process

    Process Action:Pentaho Report

    Report Specification  *.xreportspec

    Report Parameters ? 

    ¿Puede un reporte tipo *.xreportspec aceptar parámetros en una secuencia de acciones? 

    Can a report type *.xreportspec accept parameters in a sequence of actions?

  4. Anonymous

    Ciao 

    I have this problem when try to use xml report crated with Report Design, in BI Platform.

    I think that report-085.dtd is not correctly use in xml RepDes output file, but i not sure...

    can you help me to resolve my problem?? 

    Paolo (italy) 


    Failed


    Errore: RuntimeContext.ERROR_0012 - LActionDefinition per {0} non è stata eseguita con successo (org.pentaho.core.runtime.RuntimeContext)Debug: Partenza dellesecuzione di

    Unknown macro: {0}

    /

    Unknown macro: {1}

    /

    Unknown macro: {2}

    (org.pentaho.core.solution.SolutionEngine)
    Debug: Lettura del contesto a runtime e dei dati (org.pentaho.core.solution.SolutionEngine)
    Debug: Caricamento del file di configurazione dell'Action Sequence (org.pentaho.core.solution.SolutionEngine)
    Debug: Aggiunta della variabile sorgente response al parametro output_rep (com.pentaho.repository.dbbased.solution.SolutionRepository)
    Debug: Audit: instanceId=38b74e80-2097-11dc-bf66-0588faac78ff, objectId=org.pentaho.core.runtime.RuntimeContext, messageType=action_sequence_start (org.pentaho.core.runtime.RuntimeContext)
    [it_14] Error: JFreeReport.ERROR_0007 - Non è possibile effettuare il parsing del report samples\getting-started\userdb_analisis.xml - org.jfree.resourceloader.ResourceCreationException: Unable to parse the document (org.pentaho.plugin.jfreereport.components.JFreeReportLoadComponent)
    Errore: RuntimeContext.ERROR_0012 - LActionDefinition per

    non è stata eseguita con successo (org.pentaho.core.runtime.RuntimeContext)
    Errore: SolutionEngine.ERROR_0007 - Esecuzione dell'Action Sequence fallita (org.pentaho.core.solution.SolutionEngine)

  5. user-63f66

    Hi,

    I create an action sequence with an "Pentaho report" action. When I run the action sequence, the result is :

    Error: RuntimeContext.ERROR_0012 - ActionDefinition for ReportWizardSpecComponent did not execute successfully (org.pentaho.core.runtime.RuntimeContext)

    Debug: Starting execute of teste//Cesamv2Report.xaction (org.pentaho.core.solution.SolutionEngine)
    Debug: Getting runtime context and data (org.pentaho.core.solution.SolutionEngine)
    Debug: Loading action sequence definition file (org.pentaho.core.solution.SolutionEngine)
    Debug: SolutionRepository.DEBUG_FILE_PATH - getFile path=e:\pentaho\pentaho-solutions\teste\Cesamv2Report.xaction (org.pentaho.repository.filebased.solution.SolutionRepository)
    Debug: audit: instanceId=a16b9f0f-ff30-11dc-9019-8b247aedc25b, objectId=org.pentaho.core.runtime.RuntimeContext, messageType=action_sequence_start (org.pentaho.core.runtime.RuntimeContext)
    Debug: validateComponent validating component SQLLookupRule (org.pentaho.core.runtime.RuntimeContext)
    Debug: Validating component for action Cesamv2Report.xaction (org.pentaho.plugin.sql.SQLLookupRule)
    Debug: validateComponent validating component ReportWizardSpecComponent (org.pentaho.core.runtime.RuntimeContext)
    Debug: Validating component for action Cesamv2Report.xaction (org.pentaho.plugin.jfreereport.ReportWizardSpecComponent)
    Debug: Validating component for action Cesamv2Report.xaction (org.pentaho.plugin.jfreereport.components.JFreeReportGenerateDefinitionComponent)
    Debug: Validating component for action Cesamv2Report.xaction (org.pentaho.plugin.jfreereport.components.JFreeReportValidateParametersComponent)
    Debug: Executing action sequence (org.pentaho.core.runtime.RuntimeContext)
    Debug: Executing action definition: Iteration 0 (org.pentaho.core.runtime.RuntimeContext)
    Debug: audit: instanceId=a16b9f0f-ff30-11dc-9019-8b247aedc25b, objectId=SQLLookupRule, messageType=component_execution_started (org.pentaho.core.runtime.RuntimeContext)
    Debug: execute pre-audit (org.pentaho.core.runtime.RuntimeContext)
    Debug: Setting component log level to DEBUG (org.pentaho.core.runtime.RuntimeContext)
    Debug: Initializing component (org.pentaho.core.runtime.RuntimeContext)
    Debug: executeComponent starting audited execute (org.pentaho.core.runtime.RuntimeContext)
    Debug: SolutionRepository.DEBUG_FILE_PATH - getFile path=e:\pentaho\pentaho-solutions (org.pentaho.repository.filebased.solution.SolutionRepository)
    Debug: execute validation=true (org.pentaho.plugin.sql.SQLLookupRule)
    Debug: Running query - SELECT utilisateur.nom || ' ' || utilisateur.prenom as collaborateur, utilisateur.matricule as matricule, centreCout.nom as centreCoutNom, responsableValidation.nom || ' ' || responsableValidation.prenom as responsable, releve.date_debut as dateDebutReleve, releve.date_fin as dateFinReleve, releve.id_etat_releve as statut, releve.numero as noReleve, releve.completude as complet, imp.date_imputation as dateImputation, descImp.label_fr as typeImputation, descGrpImp.label_fr as groupeImputation, imp.imputation as valeur, typeImp.code as codeSAP, projet.otp as projet, projet.vendu as vendu, typeImp.unite as unite FROM csnet.t_utilisateur utilisateur, csnet.t_centre_cout centreCout, csnet.a_centre_cout_utilisateur accu, csnet.t_utilisateur responsableValidation, csnet.t_releve releve, csnet.t_releve_imputation imp LEFT JOIN csnet.t_projet_otp projet ON imp.id_projet_otp = projet.id_projet_otp, csnet.l_desc_type_imputation descImp, csnet.l_desc_group_imputation descGrpImp, csnet.t_type_imputation typeImp WHERE projet.otp = 'AZNVZA02-1' AND imp.date_imputation between '2007-07-25' and '2007-08-24' AND typeImp.code not in ('HSPS','HSPD','HSRS','HSRD') AND accu.id_centre_cout = centreCout.id_centre_cout AND accu.id_utilisateur = utilisateur.id_utilisateur AND releve.id_resp_hierarchique = responsableValidation.id_utilisateur AND releve.id_utilisateur = utilisateur.id_utilisateur AND imp.id_releve = releve.id_releve AND typeImp.id_type_imputation = imp.id_type_imputation AND descImp.id_desc_type_imputation = typeImp.id_desc_type_imputation AND descGrpImp.id_desc_group_imputation = typeImp.id_desc_group_imputation ORDER BY collaborateur, dateDebutReleve, projet, typeImputation, dateImputation; (org.pentaho.plugin.sql.SQLLookupRule)
    Debug: executeComponent finished audited execute (org.pentaho.core.runtime.RuntimeContext)
    Debug: execute post-audit (org.pentaho.core.runtime.RuntimeContext)
    Debug: audit: instanceId=a16b9f0f-ff30-11dc-9019-8b247aedc25b, objectId=SQLLookupRule, messageType=component_execution_ended (org.pentaho.core.runtime.RuntimeContext)
    Debug: audit: instanceId=a16b9f0f-ff30-11dc-9019-8b247aedc25b, objectId=ReportWizardSpecComponent, messageType=component_execution_started (org.pentaho.core.runtime.RuntimeContext)
    Debug: execute pre-audit (org.pentaho.core.runtime.RuntimeContext)
    Debug: Setting component log level to DEBUG (org.pentaho.core.runtime.RuntimeContext)
    Debug: Initializing component (org.pentaho.core.runtime.RuntimeContext)
    Debug: executeComponent starting audited execute (org.pentaho.core.runtime.RuntimeContext)
    Debug: SolutionRepository.DEBUG_FILE_PATH - getFile path=e:\pentaho\pentaho-solutions (org.pentaho.repository.filebased.solution.SolutionRepository)
    Debug: execute validation=true (org.pentaho.plugin.jfreereport.ReportWizardSpecComponent)
    Debug: SolutionRepository.DEBUG_FILE_PATH - getFile path=e:\pentaho\pentaho-solutions (org.pentaho.repository.filebased.solution.SolutionRepository)
    Debug: execute validation=true (org.pentaho.plugin.jfreereport.components.JFreeReportValidateParametersComponent)
    Debug: SolutionRepository.DEBUG_FILE_PATH - getFile path=e:\pentaho\pentaho-solutions (org.pentaho.repository.filebased.solution.SolutionRepository)
    Debug: execute validation=true (org.pentaho.plugin.jfreereport.components.JFreeReportGenerateDefinitionComponent)
    Debug: SolutionRepository.DEBUG_FILE_PATH - getFile path=e:\pentaho\pentaho-solutions (org.pentaho.repository.filebased.solution.SolutionRepository)
    Debug: executeComponent finished audited execute (org.pentaho.core.runtime.RuntimeContext)
    Error: RuntimeContext.ERROR_0012 - ActionDefinition for ReportWizardSpecComponent did not execute successfully (org.pentaho.core.runtime.RuntimeContext)
    Debug: audit: instanceId=a16b9f0f-ff30-11dc-9019-8b247aedc25b, objectId=org.pentaho.core.runtime.RuntimeContext, messageType=action_sequence_failed (org.pentaho.core.runtime.RuntimeContext)
    Error: SolutionEngine.ERROR_0007 - Action sequence execution failed (org.pentaho.core.solution.SolutionEngine)

     Can you please help me (sad) ?

    D.