Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to sort the date in crystal report

Status
Not open for further replies.

sommererdbeere

Programmer
Nov 20, 2003
112
US
hi,
i wanna sort the date in crystal report.. ihave done the group, but it still didn't work out.. here is my formula:
cstr(DatePart ("m",{DATE_ENTERED}),0)& "/" &
cstr({DATE_ENTERED}, "yyyy")

here i wanna only extract the month and year. i wanna sort according to year, however, the out put of the report looks like this: 1/2003
10/2003
12/2002
3/2003
4/2003

by how i can order them that looks like:
12/2002
1/2003
3/2003
4/2003
10/2003

many many thanks.
i thought this is pretty easy, but i found it not.. it will be great if someone can help in out. 'ocz i need to ahve this report goes out in an hour.. many many many thanks

sommer
 
Change the formula to:

cstr(DatePart ("m",{DATE_ENTERED}),"00")& "/" &
cstr({DATE_ENTERED}, "yyyy")

This will give you dates like: 02/2003

If you want to display the date like 2/2003, use your original formula for display, but use my suggested changed formula for the sort field.

-LB
 
You don't need to create a formula for Grouping, select the date field for grouping and change the section will be printed to for each month.

The default display will be as you requested.

Or you can create formulas, which is less efficient.

-k
 
Use SV's solution, but just for the record, in future instead of using :

cstr(DatePart ("m",{DATE_ENTERED}),"00")& "/" &
cstr({DATE_ENTERED}, "yyyy")

Use :

ToText({DATE_ENTERED},"MM/yyyy")

Reebo
UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top