Crystal Reports - 在所有报表组中包含空值
我有一些数据显示一个人对我们数据库中所有公司的访问次数。我想做的是显示所有访问和所有未访问的报告,按月分组。
例如,假设整个公司数据库为 CompanyA、CompanyB、CompanyC 和 CompanyD,访问数据如下(使用外连接创建,以便包含所有公司)
公司名称访问日期
A公司 10/05/10
A公司 10/05/12
A公司 10/06/18
B 公司 05/05/10
公司 C NULL
公司D 21/04/10
公司 D 10/05/14
公司 D 02/06/10
我想查看的报告是
月份 - 四月
公司 A - NULL
公司 B - NULL
公司C - NULL
CompanyD - 21/04/10
月 - 5 月
公司A - 10/05/10
公司 A - 2010 年 5 月 12 日
B 公司 - 2010 年 5 月 5 日
公司C - NULL
CompanyD - 2010 年 5 月 14 日
月份 - 六月
公司 A - 2010 年 6 月 18 日
公司 B - NULL
公司C - NULL
CompanyD - 02/06/10
我显然可以按日期月份进行分组,但这不包括我需要的该月没有访问日期的公司。水晶报表中可以做这样的报表吗?
I have some data that shows the number of visits a person has done to all companies in our database. What I would like to do is show a report of all the visits and all the ones they haven't visited, grouped by month.
For example, assuming the entire database of companies is CompanyA, CompanyB, CompanyC and CompanyD and the visit data is as follows (created using an outer join so that all companies are included)
Company Name Visit Date
Company A 10/05/10
Company A 12/05/10
Company A 18/06/10
Company B 05/05/10
Company C NULL
Company D 21/04/10
Company D 14/05/10
Company D 02/06/10
The report I would like to see is
Month - April
CompanyA - NULL
CompanyB - NULL
CompanyC - NULL
CompanyD - 21/04/10
Month - May
CompanyA - 10/05/10
CompanyA - 12/05/10
CompanyB - 05/05/10
CompanyC - NULL
CompanyD - 14/05/10
Month - June
CompanyA - 18/06/10
CompanyB - NULL
CompanyC - NULL
CompanyD - 02/06/10
I can obviously group by month of date but this won't include the companies with no visit date for that month which I need. Is this kind of report possible in crystal reports?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试制作月份和日期的“索引”表。公司(我不知道这是否是正确的术语。这就是我所说的)。从索引表到实际数据进行右连接。
您的索引表将如下所示:
编辑
由于这是正确的联接,因此您每个月都会看到所有 4 家公司,无论它们是否有数据。另外,由于您将月份硬编码到表中,因此您必须定期更新索引表,但由于复制、粘贴和退格键的神奇功能,您只需每隔几个世纪执行一次此操作。
Try making an "index" table of the month & company (I don't know if that is the right term for this. That's just what I call it). Make right joins from your index table to the actual data.
Your index table will look like:
Edit
Since it's a right join, you'll see all 4 companies each month whether or not they have data. Also, since you're hardcoding the months to the table, you'll have to update your index table periodically, but thanks to the wonders of copy,paste, and backspace, you should only have to do this every few centuries.