Avatar of Carlo
Carlo
Flag for United States of America asked on

How to group in Crystal Reports a field with contained values of 5's

I want to be able to group the unitCost value by increments of amount value in 5 in Crystal Reports 2008.
How is this accomplished?


Example:

Group 1
Item ID      Unitcost
AB123        1
AB124         2
AB125        3
AB126        5

Group 2
Item ID      Unitcost
CD123      6
CD124      6
CD125      7
CD126      10

Group 3
Item ID      Unitcost
CE123       11
CD124      12
CD127      14
CD128     15

Please help. Thanks.
Crystal Reports

Avatar of undefined
Last Comment
Carlo

8/22/2022 - Mon
Mike McCracken

Add a formula like this and group on it

whilereadingrecords;
global numbervar myrecnum;
myrecnum:= myrecnum + 1;
myrecnum \ 5

Open in new window


The first group will only have 4 records but after that they should have 5
mlmcc
Carlo

ASKER
mlmcc, I apologize I wrote it wrong....
I want the values in that field, unitCost, to be group by increments of every 5 dollar amounts.

So everything that has a value in UnitCost from 0 to 5 I Want it grouped.
Then everything from 6 to 10 I want it groups and so on...incremental values of 5 in the field.

Your answer was good though.
Mike McCracken

Try this formula

{Value Field} \ 5

Open in new window

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Carlo

ASKER
Good call though but that didn't go to well since I have values of 0.00.
Ido Millet

If you wish to call Group 0 Group 1, just add 1 to the expression mlmcc provided.
ASKER CERTIFIED SOLUTION
Mike McCracken

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Carlo

ASKER
Thanks mlmcc all I had to do then was group the report by that formula!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.