简体   繁体   English

如何将参数传递给Pentaho Report(.prpt),以便SQL查询可以动态运行以在运行时生成报告

[英]How to pass parameters to Pentaho Report (.prpt) so that sql query can run dynamically to make report at runtime

I have a static Pentaho Report(.prpt) on my pentaho server.I am trying to find the way to pass paramater to my pentaho report and refresh(update) the report using pentaho scheduler.I am able to run the sql query each time the scheduler runs. 我在pentaho服务器上有一个静态的Pentaho Report(.prpt)。我试图找到将参数传递给我的pentaho报告并使用pentaho Scheduler刷新(更新)该报告的方法。每次我都能够运行sql查询调度程序运行。 But I want to pass parameter(user data to be used in mysql query) dynamically so that I am able to generate user specific reports for all users using same prpt file on my server. 但是我想动态传递参数(要在mysql查询中使用的用户数据),以便能够使用服务器上的相同prpt文件为所有用户生成特定于用户的报告。

How can that be achieved? 如何实现? Can anyone explain with an example regarding the dynamic query scripting in Pentaho Report Designer as there is no material which can be found for the same. 任何人都可以用有关Pentaho Report Designer中动态查询脚本的示例进行解释,因为找不到相同的材料。

I am using Pentaho Report Designer and Server(8.1). 我正在使用Pentaho Report Designer和Server(8.1)。

You must first create a parameter on the report (under the Data Tab, choose Parameters and right-click to create a new parameter). 您必须首先在报表上创建一个参数(在“数据”选项卡下,选择“参数”,然后右键单击以创建一个新参数)。 Those parameters can be passed from the URL, or set via a selector/dropdown. 这些参数可以从URL传递,也可以通过选择器/下拉列表进行设置。

Then you can use the parameter by entering it into the query with a syntax such as shown below: 然后,可以通过使用如下所示的语法将其输入到查询中来使用参数:

select * from sales where customer = '$(customerParam)'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM