PDI中Pentaho Reporting Output组件能否无参数运行?如何复用prpt生成多报表
Hi there! Let's tackle your two questions step by step:
1. Can the Pentaho Reporting Output component in PDI run without parameters?
Absolutely! This component can run without any parameters as long as your prpt report doesn't require mandatory parameters to function.
If your base prpt uses a straightforward query like select * from Animals; (no parameterized filters or dynamic elements that depend on external inputs), the Reporting Output component will execute just fine—you don't need to pass any additional parameters in your PDI transformation or job.
That said, if your prpt does define required parameters (like filters or dynamic values), you'll have to supply those in the component's settings; otherwise, the job will fail with a parameter missing error.
2. Generate two independent reports from the same prpt with different queries
Great question—you definitely don't need to duplicate your prpt file for this. Here are two reliable approaches to achieve this:
Approach 1: Use parameterized queries in your prpt
This is the most common and flexible method:
- Open your base prpt in Pentaho Report Designer.
- Modify your data source query to use a parameterized filter. For example, change
select * from Animals;to:select * from Animals where ${filterClause}; - In the Report Designer, define a report parameter named
filterClausewith a default value (like1=1, which will return all records when no custom filter is provided). - Save the updated prpt.
- In your PDI transformation, set up two separate instances of the Pentaho Reporting Output component:
- For Report 1: In the component's "Parameters" tab, set the
filterClauseparameter to your desired condition (e.g.,species = 'Dog'to match yourReport_1_query). - For Report 2: Set
filterClauseto a different condition (e.g.,species = 'Cat').
- For Report 1: In the component's "Parameters" tab, set the
- Run the transformation—each component will generate a unique report using the same prpt, but with the filtered data you specified.
Approach 2: Pass pre-filtered datasets from PDI to the prpt
If you prefer to handle the data filtering directly in PDI (instead of in the prpt query), try this:
- In your PDI transformation, create two separate "Table Input" steps: one for
Report_1_queryand another forReport_2_query. - For each Table Input step, add a "Pentaho Reporting Output" component.
- In the prpt, reconfigure your data source to use a Pentaho Data Integration Dataset instead of a direct SQL query.
- In each PDI Reporting Output component, map the fields from your pre-filtered Table Input step to the dataset fields expected by the prpt.
- Run the transformation—each component will feed its own filtered dataset into the same prpt template, producing two distinct reports.
Both methods let you reuse your base prpt without rebuilding it, saving you time and keeping your setup consistent.
内容的提问来源于stack exchange,提问作者Pramod Lokare

