This report will allow the user to group by the year,
quarter, month, or week of the employee's hire date. To do this you need to
create a formula for each.
1.
Right click on the Formula Fields node in the Field Explorer window.
2.
Select New… from the pop-up menu and enter HireYear for the name. Click
the Use Editor button.
3.
Enter the following formula.
Listing 1
totext(year({Employee.HireDate}), 0, '')
This converts the year of hire to text and tells Crystal to use no decimals or thousands separator.
4.
Click the Save and close button.
5.
Do the same for the other formulas. Here is the code for each.
Listing 2
HireQuarter:
totext(Year ({Employee.HireDate}), 0, "") + "-" + totext(DatePart ("q",
{Employee.HireDate}), 0, "")
HireMonth:
totext(Year ({Employee.HireDate}), 0, "") + "-" + totext(Month
({Employee.HireDate}), 0, "")
HireWeek:
totext(Year ({Employee.HireDate}), 0, "") + "-" + totext(DatePart ("w",
{Employee.HireDate}), 0, "")