PDA

Click to See Complete Forum and Search --> : ** Resolved ** Sorting Columns Descending or Ascending


Trancedified
Mar 2nd, 2004, 11:47 AM
Hello,

I'm using Crystal Reports.NET.

I have 2 questions:

1) Is there anyway to sort a column by descending or ascending order by clicking on the column header?


2) I have a datetime field in SQL Server, but when I made the report in the designer, the years are not sorted correctly.

It's sorted like this:

1/2/2003
5/24/2001
7/3/1999

Is there a way to sort by year, not by the month?

Thanks for any solutions on either of these questions


Chris

Pasvorto
Mar 2nd, 2004, 12:27 PM
I have done the date theng also. I created a formula equal to datepart("yyyy",data field) and made it not visible. The I sort on that field.

Trancedified
Mar 2nd, 2004, 01:35 PM
Pasvorto,


Can you please elaborate on how to create this field? I am new to Crystal Reports.


Thanks


Chris

ARPRINCE
Mar 3rd, 2004, 07:59 AM
I don't see any reason why CR would sort your date in that kind of a manner UNLESS your are converting your datetime field into a text string to remove the time part in your report.

What you should do is to create a formula based on your SQL datetime field and format this so that only the date will be shown then sort the report based on this formula.

EX.
(1) Create a formula "DateSort"
(2) Edit formula where "DateSort" = DATEVALUE({Table.DateField})


I'm using CR9 so I am not sure if DATEVALUE() function is available with your version. If it is, then this would be your best bet.

Trancedified
Mar 3rd, 2004, 11:06 AM
Open the report
Right Click White Area Report OPTIONS....


Ensure Convert Date-Time Field is To Date