A group is a set of records that are related to each other in some way. For example, you might group together all of your employee in the same Zone. A Group Name field is created when you insert a group into your report.
Here, I am going to explain how to group the data in crystal report by using Group
Name Field in Visual studio 2010.
After creating a report, right click on the Group Name Fields option in the Field Explorer and select Group Expert option.
As you select Group Expert option from Group Name Field, Group Expert Dialog Box will open. Then select the field name from the object of the database and add it into Group By list and click Ok button to close the current window.
After selecting a field, group name is automatically added into the group section of the Crystal Report and a field also added in the Group Name Fields.
You can format the report by yourself as I here change the back color of group name and also change the text and font of Page Header fields from the Properties window.
You can see the output or preview of report from
Main Report Preview or run an application.
After that, I also use a formula field to display the age of employee, for that I had used a datediff function because I have columns employee_DOB(dateofbirth), employee_joining (joining date) and on the basis of that columns I can find the difference of year or employee age.
If you see preview of report it display the age in decimal floating point so in order to change the format right click on the formula field in the crystal report and change the format according to you.
Now if you see the report it will display the age in correct format.