简体   繁体   中英

Jasper Server: passing argument to get report data for customer

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

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

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.

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?

Add to the report (XML):

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

In the datasource (mongodb):

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

passing the argument:

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

Hope this will help someone else, too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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