数据库表中的标题和详细信息
我需要一个编辑器来创建一些报告,所有报告都有标题(公司名称、地址、电话、图像),该标题是从名为公司的表中读取的,并有该公司所有客户的详细示例。
我怎样才能在 iReports 中做到这一点?
有什么方法可以链接我的报告中的两个表(公司和客户)?因为“报表查询”只允许我一句话。
我使用 Java Swing 和 MySql 数据库。
感谢您的有用评论。
I need an editor to create some reports, all reports have header (company name, address, phone, image) that is read from a table called companies and have a detailed, example all customers of the company.
How could I do this in iReports?
Is there any way to link two tables (company and customer) in my report? because the "report query" only allows me a sentence.
I work with Java Swing and MySql database.
Thanks for your helpful comments.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以查看此示例。 JasperReports 分发包 包含许多其他示例(在文件夹中) %jasperreports%\demo\samples)。 iReport 文件夹 %iReport%\ireport\samples 中还有多个示例。
您的样本报告非常简单。
创建此类报告的步骤可以如下所示:
您应该阅读JasperReports 终极指南。这是一个很棒的教程。
示例jrxml文件(在iReport中设计):
结果将是(导出为pdf格式的报告):
更新:
要使用公司信息填充标题,您可以使用 < em>组乐队。您可以在此处阅读有关群组的信息。
您的查询将如下所示:
您还应该为
companies
表 (companies.name<例如 /code>
、
companies.contactInfo
、companies.id
):之后您应该添加组
idCompany
(companies
表中的唯一键)。然后将带有字段(
companyName
、contactInfo
)的 textField 元素放入组乐队。You can look at this samples. The JasperReports distribution package contains many others samples (in folder %jasperreports%\demo\samples). The iReport has also several samples in folder %iReport%\ireport\samples.
Your sample report is very simple.
The steps for creating the such report can be like this:
You should read the JasperReports Ultimate Guide. It is a great tutorial.
The sample jrxml file (designed in iReport):
The result will be (the report exported to pdf format):
UPDATE:
For filling header with company info you can use the Group band. You can read info about groups here.
You query will be like this:
You should also add report's fields for data from
companies
table (companies.name
,companies.contactInfo
,companies.id
, for example):After that you should add group by
idCompany
(the unique key fromcompanies
table).And then put the textField elements with fields (
companyName
,contactInfo
) to the Group band.