在Birt处理程序上使用Javascriprt reportContext.setPersistentGlobalVariable方法在procrocesses之间传递对象 [英] Using Javascriprt reportContext.setPersistentGlobalVariable method on Birt handlers To pass objects between proccesses

查看:694
本文介绍了在Birt处理程序上使用Javascriprt reportContext.setPersistentGlobalVariable方法在procrocesses之间传递对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将变量从工厂进程传递到运行进程,
在eclipsde UI透视图中使用reportContext.setPersistentGlobalVariable。
在数据集的onFetch()中,代码如下所示:

I trying to pass variable from the factory process to the run process , using reportContext.setPersistentGlobalVariable in the eclipsde UI perspective. In the onFetch() of the data set the code look like this:

var flag = "hello";
reportContext.setPersistentGlobalVariable("flag", flag);

在beforeRender报告的方法设计代码如下:

In the beforeRender() method of the report design the code look like this:

var flg = reportContext.getPersistentGlobalVariable("flag");
reportContext.getDesignHandle().findElement("text").setContent(flg);

应该注意的是,当我将两个代码片段放在两个报表设计的..()方法中时,这段代码是有效的。
不知怎的,数据不会在两个进程之间传递,thx&希望你们的帮助。

It should be noted that this code is works when I put the two snippets in two of the report design on..() methods. Somehow the data not pass between the two processes , thx & hope for your'e help.

推荐答案

我能够重现类似于你所描述的行为。请尝试在报表的末尾插入一个动态文本元素,并设置此表达式,它应该起作用:

I was able to reproduce a behavior similar to what you describe. Please try to insert a Dynamic text element at the end of the report and set this expression, it should work:

reportContext.getPersistentGlobalVariable("flag");

很可能您的报告正在运行一个独特的RunAndRender任务,而如果我们想利用ofRender& onRender事件我们应该使用两个单独的运行和渲染任务。

Most likely your reports are running with a unique "RunAndRender" task, whereas if we want to take advantage of beforeRender & onRender events we should use two separate "Run" and "Render" task.

在Eclipse Designer的实践中,如果我们使用Web查看器运行报告(在Web查看器中查看报表),则有两个单独的任务,但如果直接运行导出(查看报告为xxx)有一个任务。

In practice with Eclipse Designer, if we run reports using the Web Viewer ("View report in Web Viewer") there are two separate tasks but if we directly run an export ("View report as xxx") there is a single task.

这就是说,重要的是要注意处理渲染事件是棘手的:大多数时候,当你尝试在这里改变designHandle元素是太晚了。例如,即使元素的可见性属性也不能在渲染时更改。您可以使用此元素的onRender事件更改文本的内容:

That said, it is important to notice handling render events is tricky: most of the time it is too late to change designHandle elements as you try to do here. Even the "visibility" property of elements can't be changed at render time, for example. You can change the content of a text using "onRender" event of this element though:

this.text=reportContext.getPersistentGlobalVariable("flag");

这篇关于在Birt处理程序上使用Javascriprt reportContext.setPersistentGlobalVariable方法在procrocesses之间传递对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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