[英]Crystal Reports - Grouping records
I'm trying to group records based on an age range formula where the ranges overlap and it's possible a person will belong to more than one range, my formula looks as follows 我正在尝试根据年龄范围公式对记录进行分组,其中范围重叠,并且一个人可能属于多个范围,我的公式如下
if {@Age} in 55 to 75 then
"55-75" else
if {@Age} in 40 to 75 then
"40-75" else
if {@Age} in 18 to 75 then
"18-75"
My problem is I can't get the people to show up in multiple groups if they belong to more than one. 我的问题是,如果一个人属于一个以上的群体,我就无法让他们出现在多个群体中。
Simple answer: what you are trying to do won't work. 简单的答案:您尝试执行的操作无效。 Crystal Reports will place the record in one and only one group.
Crystal Reports会将记录放在一个并且只有一个组中。
If you just need to tally values, I would suggest the following: 如果您只需要计算值,我建议以下几点:
//{@bucket 01}
if {@Age} in 55 to 75 then
1
else
0
//{@bucket 02}
if {@Age} in 40 to 75 then
1
else
0
//{@bucket 03}
if {@Age} in 18 to 75 then
1
else
0
If you really need to group by age range, you will need to switch to a Command (instead of using the visual-linking 'expert'), then create a UNION query that creates recordsets for each bucket. 如果您确实需要按年龄范围分组,则需要切换到命令(而不是使用可视链接“专家”),然后创建一个UNION查询,该查询为每个存储桶创建记录集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.