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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple (?) sort on paramter

Status
Not open for further replies.

mmwdmr

Technical User
Jan 10, 2002
119
US
I am using version 9 attaching to Oracle through a command object. I am trying to sort the report by Next Date, Zip Code or Employee Name based on the following formula:

if (UpperCase({?SortType}) = 'NEXT DATE') then
ToText({Command.NEXTDATE}, 'yyyyMMdd' )else
if (UpperCase({?SortType}) = 'ZIP CODE') then ({Command.ZIPCODE}) else
if (UpperCase({?SortType}) = 'EMPLOYEE') then
ToText({Command.EMPLOYEENAME})

When I remove the ToText from in front of the date field, Crystal says it is expecting a string there. If I leave the ToText in front of the date, the date will not sort in the correct order. Does anyone know of a way around this? Thanks!
 
If you leave the totext there, the date SHOULD sort in correct order with the "yyyyMMdd"--so I wonder whether you might have a group on a datefield that is superceding your parameterized sort order.

-LB
 
I inherited this report from someone else. I don't see another grouping on a different date field. That is why I posted - this should work.

What I haven't checked is the SQL - may there is a GROUP BY on another date field in there.

Thanks!
 
Check if the Crystal report has groups. Check Report > Record Sort Expert. Also Report > Group Sort Expert; it may have been set to sort certain groups first.

If that doesn't do it, say just what is going wrong. What order does it use?

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Check the left-hand margin of the report to see what sections the report is using.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top