在Crystal Reports中按两个字段分组 [英] Group by two fields in Crystal Reports

查看:92
本文介绍了在Crystal Reports中按两个字段分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在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


解决方案

所提供的通用数据含糊不清,因此我将提供自己的示例(在第一行)

 EmployeeName, WeekNumber, DayOfWeek, HoursWorked 
John Doe,20, Monday ,8
John Doe,20,星期二,8
John Doe,20,星期三,8
John Doe,21,星期四,8
John Doe,21,星期五,8
Jane Doe,20,星期一,8
Jane Doe,20, Tuesda y,8
简妮(Jane Doe),21,星期三,8
简妮(Jane Doe),21,星期四,8
简妮(Jane Doe),21,星期五 ,8

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

 John Doe 
每周:20
星期一8小时
星期二8小时
星期三8小时
每周:21
星期四8小时
星期五8小时

Jane Doe
每周:20
星期一8小时
星期二8小时
每周:21
星期三8小时
星期四8小时
星期五8小时

如果是这种情况,您可以按首先输入 EmployeeName字段,然后使用组选项通过插入菜单简单地为 WeekNumber添加另一个组。这非常简单,您可以在各个级别的字段上进行汇总。唯一会引起多级分组的毛病是,如果您正在计算组内的字段,并希望将这些计算返回到较高的分组级别进行求和,这将需要在报告中声明全局变量。 / p>

在过去的7年中,我一直在大量使用Crystal Reports。


How can I group by two different fields in a Crystal Report?

Foe example :

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

I want the report to look like

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

val12
-------
val3|val7

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

val12 :
------
val3|val9

解决方案

The generic data provided is rather vague, so I will provide my own to demonstrate (with field names on the first line)

"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

Assuming that I read the question correctly, you would want the report to look like this:

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

If this is the case, you would group by the "EmployeeName" field first, and then simply add another group for "WeekNumber" via the Insert menu using the Group option. This is pretty straightforward, and you can do summaries on the fields at various levels. The only thing that would get "hairy" with multiple tier of grouping would be if you were calculating fields within the group and wanted to return those calculations to a higher level of grouping for summation, which would require declaring global variables within the report.

For what it's worth, I've been using Crystal Reports heavily for the past 7 years.

这篇关于在Crystal Reports中按两个字段分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆