Jasper Server:传递参数以获取客户的报告数据 [英] Jasper Server: passing argument to get report data for customer

查看:172
本文介绍了Jasper Server:传递参数以获取客户的报告数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎遇到了这里描述的问题: iReport:将参数从主报表查询传递到表或列表的数据集查询

I have almost the problem described here: iReport: Passing parameters from a main report query to a dataset query for a table or list

但是因为它是一个几年前,我正在使用iReports 5.1和Jasper Server的最新版本。

but since it's a few years old, I'm using iReports 5.1 with the newest comnunity version of Jasper Server.

我可以从服务器上通过PHP获取报告,但我想要将参数传递给报表以仅显示不同客户的信息,在数据库中具有类似customerId的信息。所以它只为给予customerId生成报告。

I am able to fetch reports by PHP from the server, but I want to pass a parameter to the report to only display information for a distinct customer, having something like customerId in the database. So it only generates a report for a give customerId.

我不想为每个客户创建一份报告。

I don't want to create a single report for every customer.

如何通过API将参数传递给数据源/主报告?

How can I pass arguments to the datasource/main report, through the API?

其他问题:是否可以将此参数/参数添加到计划中报告?

Additional question: Is it possible to add this argument/parameter to scheduled reports?

推荐答案

添加到报告(XML):

Add to the report (XML):

<parameter name="CUSTOMERID" isForPrompting="false" class="java.lang.String">
</parameter>

在数据源(mongodb)中:

In the datasource (mongodb):

{'collectionName':'test', findQuery : { customerId: $P{CUSTOMERID} }}

传递参数:

 ws_runReport($currentUri, $report_params,  $output_params, $attachments);

希望这也可以帮助其他人。

这篇关于Jasper Server:传递参数以获取客户的报告数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆