iReport的报表查询对话框中的多个查询
我想使用 ireport 制作以下类型的报告:
Total Items: TOTAL_NO_OF_ITEMS
Damaged Items: NO_OF_DAMAGED_ITEMS
Non Damaged Items: NO_OF_NON_DAMAGED_ITEMS
表结构是:
Items{
item id int PK,
item_status varchar <!--having values as 'damaged' or 'non-damaged')-->
}
在iReport 的报告查询对话框中,我可以给出查询:
select count(*) item_counts , item_status status from Items group by item_status;
这将为
Damaged Items: NO_OF_DAMAGED_ITEMS
Non Damaged Items: NO_OF_NON_DAMAGED_ITEMS
报告中的行生成 BUT:
Total Items: TOTAL_NO_OF_ITEMS
我必须再运行一个查询:
select count(*) total_items from items
所以我想问一下如何在报告对话框中使用 ireport 对单个 jrxml 文件进行多个查询?
谢谢...
I want to make following kind of report using ireport:
Total Items: TOTAL_NO_OF_ITEMS
Damaged Items: NO_OF_DAMAGED_ITEMS
Non Damaged Items: NO_OF_NON_DAMAGED_ITEMS
Table structure is:
Items{
item id int PK,
item_status varchar <!--having values as 'damaged' or 'non-damaged')-->
}
In iReport's Report Query Dialog box I can give query:
select count(*) item_counts , item_status status from Items group by item_status;
that will generate
Damaged Items: NO_OF_DAMAGED_ITEMS
Non Damaged Items: NO_OF_NON_DAMAGED_ITEMS
BUT for the line in report:
Total Items: TOTAL_NO_OF_ITEMS
i have to run one more query :
select count(*) total_items from items
So i want to ask how to can i give more than one queries for a single jrxml file using ireport in Report Dialog Box?
Thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于此类问题不需要多次查询。如果需要,您可以在数据库中进行所有处理:
或者您可以在数据库中不进行任何处理:
然后在报告中创建 3 个变量来计算您的 3 个所需值。
当然,您也可以使用混合动力。保持当前查询不变,并添加一个变量来汇总损坏和未损坏的项目以获得总数。
There's no need for multiple queries for this type of problem. You could do all of the processing in the database if you want:
Or you could do no processing in the database:
Then in the report create 3 variables to calculate your 3 desired values.
And of course you could use a hybrid. Keep your current query unmodified, and add a variable that sums up the damaged and undamaged items to get the total.