Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: How to pass parameters to StaticDataFactory

  1. #1
    Join Date
    Jul 2009
    Posts
    14

    Default How to pass parameters to StaticDataFactory

    Hello,

    I am using CITRUS PRD release to create a layout for multiple reports. These sub-reports have their own custom data Set defined via 'Named Java Method Invocation' with query defined as <class name>#<method name>(parameter1).

    In a replay to another question in the forum http://forums.pentaho.org/showthread...tom+datasource

    it was mentioned that the parameters are names of a field from the current data-row or the initial report-parameters.

    Can someone please explain what that means or point to documentation? Also, how does one define current data-row or the initial report-parameters.
    Can these parameter values be dynamic or based on certain conditions? Where can one define these rules?

    Appreciate your help,
    Parag

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

    Default

    The current data-row is the data-view on the current state of the report-processing. It is a name-value mapping between the available columns and their current value. The available columns are the sum of all columns coming from the database, all named functions and expressions and all parameters. However, when querying the data, functions and expressions are not available to the data-factory, as they get initialized *after* the query has been performed.

    You define parameters in the static-datafactory by just mentioning their name:

    example.code.MyMagicClass#createTableModel(yourColumnHere)

    The query above would try to locate a column "yourColumnHere" in the current data-row and would then pass the value found in there to the method "createTableModel".

    If your datafactory is called from a master-report, the current-datarow only contains the parameters you have defined on the report. The datafactory of a subreport contains the values imported from the parent report. A data-factory called via the "SingleValueQueryFunction" receives all columns the current report has to offer.


    Its also worth to mention that subreports are encapsulated from the master-reports. So by default, subreports do *not* see any of the master's fields. You have to declare the import parameters on the subreport to retrieve values from the master into subreport.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Jul 2009
    Posts
    14

    Default

    Thanks for the quick reply.
    With that information it appears that I'm going to need a report initialization parameters that do not exist in a database. It could be parameters (userid,password) for a db connection or path of a xml file. It is expected that my custom extended DataFactory class will then be able to intialize the TableModel data.
    Does that sound correct? If so, what's the mechanism to pass the report intialization parameter values?

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.