iReport + XPath - 字符串列总和
我正在构建一个报告,其中有一个子报告。该子报表通过 XPath 带来一些数据,这意味着它是来自 XML 的所有字符串。该子报告的其中一列有一些值,我需要对它们进行求和并显示在表的末尾。
我不知道如何让它发挥作用。我尝试使用 sum 参数创建一个变量,但它不起作用。
以前有人需要这个吗?
设想: 我从 XPath 查询加载很多值,例如: /something/something1/something2
这个查询根据我的需要返回一些字段。我用它们构建了一个表格(在子报表中)。问题是:最后一列 (4),值是来自 XML 的字符串。
iReport 版本:3.0.0
真的谢谢!
I'm building a report where I have a subreport. This subreport brings some data through XPath, this means it's everything strings from a XML. One of the columns of this subreport has some values, where I need do sum them and show in the end of the table.
I don't know how to put this to work. I've tried to create a variable with sum parameter, but it does not work.
Did anybody need this before?
Scenario:
I load a lot of values from a XPath query, e.g:
/something/something1/something2
This query returns some fields according to my needs. With them I build a table (in a subreport). The problem is: the last column (4), values are strings from XML.
iReport version: 3.0.0
Really thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:
我需要什么?根据原始帖子,包含通过 XPath 从 XML 读取的字符串的列和包含总和的页脚。
SUM 列的结果
该怎么办?创建一个变量来保存总和。创建完成后,进行编辑。例如:在此处输入图像描述
用您需要的格式填充变量表达式。这里我用的是
点击确定。现在变量已创建,您必须创建一个新的文本字段,在其中显示总和。创建它并编辑它。这里我使用了以下格式:
单击“应用”即可。编译您的报告,现在您将获得预期的结果。当然,你可以做一些调整,但总的来说就是这个过程。
Solution:
What I needed? According to the original post, a column with strings read from a XML through XPath and a footer with the sum.
Result from column SUM
What to do? Create a variable where you'll keep your sum. After created, edit it. e.g:enter image description here
Fill variable expression with the format you need. Here I used
Click ok. Now the variable is created, you must create a new TextField where you'll show your sum. Create it and edit it. Here I used the following format:
Click "Apply" and that's all. Compile your report and now you'll have the expected result. For sure, you can do some adapt, but in general this is the process.