We help IT Professionals succeed at work.

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

Carlo Vasquez
on
96 Views
Last Modified: 2019-01-21
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.
Comment
Watch Question

Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
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

Author

Commented:
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 McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
Try this formula

{Value Field} \ 5

Open in new window

Author

Commented:
Good call though but that didn't go to well since I have values of 0.00.
Ido MilletProfessor Emeritus of MIS at Penn State Erie and Owner, Millet Software
CERTIFIED EXPERT

Commented:
If you wish to call Group 0 Group 1, just add 1 to the expression mlmcc provided.
Senior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
Thanks mlmcc all I had to do then was group the report by that formula!