×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Dynamic sorting of details within group

Dynamic sorting of details within group

Dynamic sorting of details within group

(OP)
Hi,
This sounds really simple but I can't seem to find the solution.
My report is for inventory items. Those items have a field called 'status'. The status can be either 'active' or 'inactive'. There is also a field 'status_date' which is the date that the status field changed.
The report groups on 'status'.
My issue: How can I sort the detail records in the status group ascending or descending based on the status?
If the status = 'active', sort by status_date ascending (oldest dates listed first).
If the status = 'inactive', sort by status_date descending (newest dates first).

Thanks in advance.

** I am using Crystal 2011

RE: Dynamic sorting of details within group

Create a formula
@sort
If Status = 'Active' then DateDiff("d",dateadd('d',-365,currentdate),StatusDate) // gives date diff from date in past increases as dates get older
else
DateDiff("d",StatusDate,dateadd('d',365,currentdate))// gives date diff from date in in future increases as dates get earlier

Replace relevant parts with your fields Currentdate is a valid crystal function
Sort on this formula set as ascending

Ian

RE: Dynamic sorting of details within group

(OP)
Thanks Ian. That formula worked like a charm in the Record Sort Expert.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close