In crystal report with groups if we add record numbers then it show record number considering all rows not group wise. To overcome this problem and to show record numbers according to groups follows these steps.
Consider the following Employees table.
Step 1: Design report as below. With groups based on Department column.
Step 2: Now add new formula field "Formula1" and in formula editor write below code.
- WHILEPRINTINGRECORDS;
- GLOBAL NUMBERVAR SerialNumber;
- SerialNumber := 0;
Step 3: Add "Formula1" field in group header section. And suppress it like below.
Step 4: Create another formula field as "Formula2". And Write below code.
- WHILEPRINTINGRECORDS;
- GLOBAL NUMBERVAR SerialNumber;
- SerialNumber := SerialNumber + 1;
Step 5: Add this formula field in details section. And change its header as "Sr. No" as below.
Step 6: As in "Formula2" we returning number variable by default shows number in decimal format. To avoid this right click on "Formula2" field. Then go to Format Object option and change number format.
Step 7: Save report and Preview it.

Haris HarisPosted Nov 22, 2020, 12:38 AM
A simple way, without using any formulaAdd running total field. Give it proper name. Field to summarize : Select group column name to summarize. Type of summary : Select "count". In evaluate select "On Change of Group". Reset : select "Never".
Pushpendra SinghPosted Nov 2, 2019, 12:40 AM
Thanks Ranjit . It's very helpful for me.
Sabari. PriyaPosted Jul 30, 2018, 12:36 AM
I want to record like this and print in new sheet. E.g Development one page and testing records in one page
Radhakrishnan VPosted Nov 19, 2016, 6:20 AM
Thanks mr ranjit. help lot
mohsin raraniPosted Apr 13, 2016, 9:47 AM
Thank You so much bro
Sonu ChaudharyPosted Mar 31, 2016, 11:58 AM
good one share