当前位置:  开发笔记 > 编程语言 > 正文

在Crystal Reports中按两个字段分组

如何解决《在CrystalReports中按两个字段分组》经验,为你挑选了1个好方法。

如何在Crystal Report中按两个不同的字段进行分组?

敌人的例子:

val1|val2|val3|val6
val1|val12|val3|val7
val11|val2|val3|val8
val11|val12|val3|val9

我希望报告看起来像

val1 :
=======
val2 
----
val3|val6

val12
-------
val3|val7

val11  :
=========
val2
-----
val3|val8

val12 :
------
val3|val9

小智.. 6

提供的通用数据相当模糊,所以我将提供自己的演示(第一行有字段名称)

"EmployeeName","WeekNumber","DayOfWeek","HoursWorked"
"John Doe",20,"Monday",8
"John Doe",20,"Tuesday",8
"John Doe",20,"Wednesday",8
"John Doe",21,"Thursday",8
"John Doe",21,"Friday",8
"Jane Doe",20,"Monday",8
"Jane Doe",20,"Tuesday",8
"Jane Doe",21,"Wednesday",8
"Jane Doe",21,"Thursday",8
"Jane Doe",21,"Friday",8

假设我正确地阅读了问题,您希望报告看起来像这样:

John Doe
   Week: 20
      Monday       8 hours
      Tuesday      8 hours
      Wednesday    8 hours
   Week: 21
      Thursday     8 hours
      Friday       8 hours

Jane Doe
   Week: 20
      Monday       8 hours
      Tuesday      8 hours
   Week: 21
      Wednesday    8 hours
      Thursday     8 hours
      Friday       8 hours

如果是这种情况,您将首先按"EmployeeName"字段进行分组,然后使用"组"选项通过"插入"菜单为"WeekNumber"添加另一个组.这非常简单,您可以在各个级别的字段上进行摘要.如果您计算组内的字段并希望将这些计算返回到更高级别的分组以进行求和,那么在多层分组中获得"毛茸茸"的唯一方法就是在报告中声明全局变量.

值得一提的是,在过去的7年里,我一直在大量使用Crystal Reports.



1> 小智..:

提供的通用数据相当模糊,所以我将提供自己的演示(第一行有字段名称)

"EmployeeName","WeekNumber","DayOfWeek","HoursWorked"
"John Doe",20,"Monday",8
"John Doe",20,"Tuesday",8
"John Doe",20,"Wednesday",8
"John Doe",21,"Thursday",8
"John Doe",21,"Friday",8
"Jane Doe",20,"Monday",8
"Jane Doe",20,"Tuesday",8
"Jane Doe",21,"Wednesday",8
"Jane Doe",21,"Thursday",8
"Jane Doe",21,"Friday",8

假设我正确地阅读了问题,您希望报告看起来像这样:

John Doe
   Week: 20
      Monday       8 hours
      Tuesday      8 hours
      Wednesday    8 hours
   Week: 21
      Thursday     8 hours
      Friday       8 hours

Jane Doe
   Week: 20
      Monday       8 hours
      Tuesday      8 hours
   Week: 21
      Wednesday    8 hours
      Thursday     8 hours
      Friday       8 hours

如果是这种情况,您将首先按"EmployeeName"字段进行分组,然后使用"组"选项通过"插入"菜单为"WeekNumber"添加另一个组.这非常简单,您可以在各个级别的字段上进行摘要.如果您计算组内的字段并希望将这些计算返回到更高级别的分组以进行求和,那么在多层分组中获得"毛茸茸"的唯一方法就是在报告中声明全局变量.

值得一提的是,在过去的7年里,我一直在大量使用Crystal Reports.

推荐阅读
小色米虫_524
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有