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!

soting dates in a month

Status
Not open for further replies.

PeriyurParthi

IS-IT--Management
Jul 18, 2001
258
IN
hi all
i have filtered the dates in a dob filed useign parameter as follows

month({EmpMaster.DOB})={?monthParam}

the records have to sorted in datewise in that month?
for eg:
01/01/1975
10/01/1980
2/01/1985
15/01/1995

i need it as

01/01/1975
02/01/1990
10/01/1980
15/01/1985

replies will be helpful. thanks
parthi
 
So, you need to sort the date field as a string. Create a formula as follows:

ToText({EmpMaster.DOB},"MM/dd/yyyy")

(Note that the "MM" is case-sensitive)

Once you have this formula created, use the Record Sort Expert to sort the data on this formula field.
 
dear fvtrain & dgillz,
thanks for your postings.i hope you havent understand my problem. i need to sort under a day wise. ill be haveing different years. but i need it.below dates are under dd/mm/yyyy format.

01/01/1975
10/01/1980
2/01/1985
15/01/1995

i need it as

01/01/1975
02/01/1990
10/01/1980
15/01/1985

to sort under day wise.
thanks a lot cheers
periyur
 
Hi Parthi,

It looks like you want to ignore the years, and sort by day within the month, so this should work. Create a formula {@Days} and use this as your sort field (report->sort records), but do not place it on the report canvas:

Date(2000, Month({EmpMaster.DOB}), Day({EmpMaster.DOB}))

(I used 2000, because it was a leap year, and allows for Feb. 29 dates)

Then put your actual date field on the report canvas, and use customize to get the correct format, first selecting date only, and then on the date tab, choosing Order "DMY", and selecting "03" for month and "01" for day.

-LB
 
thanks LB that works fine. but i need to complete data in a field. ie includeing year. now the result is like

01/01/2003
02/01/2003
10/01/2003
15/01/2003

thanks LB.bye
periyur
 
Create a formula that is just:

Day ( {EmpMaster.DOB} )

Sort on this field, but do not display it. Display the original date field.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
Parthi,

As I said in my post, and as Ken has also said, only use the formula {@Days) as a sort field, but put your regular date field {table.date} on the report:

(Sort using Display using
{@date}) {table.date}

(01/01/2000) 01/01/1975
(02/01/2000) 02/01/1985
(10/01/2000) 10/01/1980
(15/01/2000) 15/01/1995

If you use my formula, use 2000 because of leap year. If you will always limit your report to a one-month period (as planned), then you can just use day ({table.date}) as Ken suggested.

-LB
 
thanks lb & kenhamady, that works fine. thanks a lot.
periyur
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top