简体   繁体   English

Crystal Reports案例陈述

[英]Crystal Reports Case Statement

I have two tables, [TASKS] and [EVENTS] . 我有两个表, [TASKS][EVENTS] [EVENTS] is linked to [TASKS] by the key [EVENTS.TASKID] = [TASKS.TASKID] with a one-to-many relationship (ie each task can have multiple events). [EVENTS]通过键[EVENTS.TASKID] = [TASKS.TASKID]与一对一关系链接到[TASKS] (即每个任务可以有多个事件)。

I am trying to write a Crystal Report that will return the number of tasks that do, and the number of tasks that do not have a specific event type. 我正在尝试编写一个Crystal Report,它将返回执行的任务数以及没有特定事件类型的任务数。

In SQL I'd use a Case statement, but can't see how to achieve this in Crystal. 在SQL中我会使用Case语句,但是看不到如何在Crystal中实现这一点。 The output I'm after is something along the lines of: 我需要的输出类似于以下内容:

                | # |
----------------+---+
Has event       | 5 |
----------------+---+
No event        | 9 |
----------------+---+
Total           | 14|
----------------+---+

Group on Task 任务小组

Create a formula that Returns 1 if the event type matches and zero otherwise. 创建一个公式,如果事件类型匹配则返回1,否则返回零。

Place a formula in the Task Group Footer that adds 1 to a global variable if the MAX of that formula by Task group is 1. Use a Report Formula to display the final value of that global variable. 如果任务组的该公式的MAX为1,则在“任务组页脚”中放置一个公式,该公式将全局变量加1。使用“报表公式”显示该全局变量的最终值。

Same logic for MAX = 0 applies to the question of how many Tasks don't have a matching events. MAX = 0的相同逻辑适用于有多少任务没有匹配事件的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM