在 BIRT 中,如何从 JavaScript 访问任意数据集?
我正在 BIRT 中构建我的第一份报告。
很快我就遇到了一个问题,我想根据一个表达式显示一些文本或数据,其中包括来自两个不同表的数据(不是可以/应该连接的表 - (假设的例子 - 从学生的记录中获取 ACT 分数)我很快意识到数据元素必须绑定到数据集(只有其中一个)。
我发现了一个 BIRT 邮件列表中的类似问题帮助我找到了解决方案 - 我可以将单个数据元素绑定到不同的数据集, 它仍然可以访问其容器的元素。我可以将参数发送到该元素绑定到的数据集(例如我上面提到的示例中的“ACT”)。
但 使用来自三个不同表的数据我被困在这里,我假设有一种方法可以通过脚本功能来做到这一点,但我还没有在文档中看到一种从数据集中提取数据的方法 - 一切到目前为止,我已经处理了与将报表元素绑定到数据集相关的问题。
需要明确的是,我已经看到我可以将 JavaScript 函数添加到顶级报告的初始化部分(并从数据元素中的表达式调用它们),但我不知道如何在脚本中查询我的任何数据集——而不是仅与绑定到我的数据元素的数据集进行交互)。
如何从 BIRT 中的 JavaScript 访问任意(尽管已经定义)数据集? (或者我如何从一个元素访问两个以上的数据集 - 一个是它绑定的,另一个是它的容器绑定的?)
I am building my first report in BIRT.
Very quickly I ran into a problem in which I wanted to display some text or data based on an expression that included data from two different tables (not tables that can/should be joined - (hypothetically example- take a student's ACT score from his record in the student table and compare it against the statistics table's entry for ACT statistics). I soon realized that a data element has to be bound to a dataset (only one of them.)
I found a similar question in the BIRT mailing list which helped me get to a solution - I can bind an individual data element to a different dataset, but it can still access the elements of its container. I can send a parameters to the dataset that the element is bound to (e.g. "ACT" in the example I mentioned above).
Eventually however, I came to a place where I needed to use data from three different tables. I am stuck here, and I'm assuming that there is a way to do this through the scripting abilities, but I have yet to see in the documentation a way to extract data from a data set - everything I have dealt with so far is associated with binding a report element to a dataset.
To be clear, I have seen that I can add JavaScript functions to the initialize section of the top level report (and call them from an expression in a data element) but I don't see how in a script I can query any of my datasets -- as opposed to only interacting with the dataset bound to my data element).
How can I access an arbitrary (though already defined) data set from JavaScript in BIRT? (Or how can I access more than two datasets from an element - one that it is bound to, and one that its container is bound to?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经有一段时间没有尝试这样做了。 立即浮现在脑海中的答案是,您需要将第三个数据集放入表中(可以将可见性设置为 false),并且需要将表值填充到 GlobalValue。 然后您可以通过脚本从数据控件中获取 GlobalValues。
我知道这并不漂亮。 我将在周末查看 2.3 是否添加了任何使这变得更容易的功能。
I have not tried to do this for a while. The immediate answer that pops to mind is that you need to put the third data set into a table (can have visibility set to false) and you would need to populate the table values to a GlobalValue. Then you could get at the GlobalValues from the data control through script.
I know that it is not pretty. I will have a look over the weekend and see if 2.3 has added any functionality that makes this easier.
使用
which will return the current column's binding value instead of
Use the
which will return the current column's binding value instead of