ccole
ccole

Reputation: 1

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.

Upvotes: 0

Views: 1220

Answers (1)

craig
craig

Reputation: 26262

Simple answer: what you are trying to do won't work. Crystal Reports will place the record in one and only one group.

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.

Upvotes: 2

Related Questions