0

I'd like to run a report in a custom application (no birt viewer, direct integration of the report engine in the application code for rendering reports under the hood and providing links to the final documents).

After rendering the report I need to read back specific values which were calculated in the report - e.g. for pushing it towards a webservice of a different application.

Imagine an invoice report with master and details which calculates in the master section then the aggregated payment sum of all invoice details. If I would need to pass the calculated payment sum to a payment service from the appplication (not in the report!) - how would I do that ?

  • I've seen DataExtractionTasks in the Birt API. However they seem to be heavily query-related in the rare examples I found and I am not sure if they would somehow work with non-resultset data as well.

  • I tried to use GlobalPersistentReportVariables and access them after rendering the report via the API - however via the API they always seem to be null. Not sure if this is the "right way" to access calculated report values. I think they are mainly provided for sharing data in between different report elements like tables.

I certainly do not want to duplicate the report logic in the application just to calculate the payment sum again.

4

2 回答 2

1

虽然我认为理论上 DataExtraction 任务是正确的,但我无法获得一个简单的报表元素(例如动态文本元素)的值来将其发布到其他地方。

我现在通过滥用神圣的 appContext(通用用途的任何东西)将所需的数据返回到我的应用程序中来工作(报告将计算值写入 appcontext - 应用程序在呈现报告后读取)。

于 2012-04-24T17:36:05.650 回答
0

首先是集成 --> http://wiki.eclipse.org/Birt_3.7_Migration_Guide

其次,您必须为 BIRT 创建自定义 XML 插件。

将该插件添加到您的集成 BIRT 中。

现在以 XML 格式呈现您的报告(记住 XML 格式将在您的插件中定义,因此请提供这样的格式,以便您可以使用任何 javascript、jquery 或 Java 文件轻松阅读它)

现在做任何你喜欢的计算/操作。

就我而言,我有 2 个上下文文件,即

Context-1(Myapplication.war)--calling-->> Context-2(带有自定义XML插件的BIRT.war)

我使用带有 URL 的 javascript XMLRequest 方法调用 BIRT 报告:“http://localhost:8080/birt/framset? _report =GraphReport1.rptdesign& _format=xml”

并在 javascript 中读取 xml 格式并根据数据显示自定义的 jquery 图。

于 2012-04-23T10:28:33.033 回答