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

Two level sort 1

Status
Not open for further replies.

csm2

IS-IT--Management
Dec 6, 2000
84
US
User can request a 'ID# within Date' sort order or 'Date within ID#' sort order. How do I setup the formula(s) to achieve this? Am using CR 6 with Informix DB.
 
r u using any parameter asking user to enter ID# and date or u jus wanna sort ID# inside Date which is also sorted..,in latter case u can jus jus GROUP ur Report on Date and when u do so make sure to make decision ASC or DESC and then go to SORT button and choose ID number and add it after the DATE as Date being a group has higher priority...,
and if u r asking to enter date and ID# to user u need to write a Query using the parameter names which comes automatically in FORMULA EDITOR...,jus double click to insert them in Query and complete the query...
My answers are based on Crystal rep ver 7.0 and doesn't know if it works in 6.
Best of luck..
 
Thanx for your suggestions.
I need to be more exact in stating problem. User supplies date range (StartDate, EndDate) and sort order (ID# within Date or Date within ID#). To take your idea a step further, if I can conditionally group on the major field then I can sort the minor field.
 
Look at the FAQ for common formulas, and look at formula #4.

You will need 2 formulas with these "if-then" statements that each selects one field based on your parameter. You will use these fields as sort and group fields, one to select the primary Sort/Group field and the other to select the secondary.

Since your data fields are different data types you will need to convert both to text. Otherwise the "if - then" formulas won't work Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Thank you, Ken. It worked like a charm.

I don't want to push my luck, but sooner or later my user will request a three or more level sort. Is there a general rule for accomplishing this? Would I use Group1, Group2...GroupN and than try to sort each one?
 
I don't know if it happens enough for a general rule, but this will work with any number of levels.

The trick will be what to do if they only want 2 levels instead of 3 some time. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top