Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sorting crystal reports within a formula

Posted on 2013-01-17
2
Medium Priority
?
1,111 Views
Last Modified: 2013-01-17
I have the following formula that allows to select to field on want to sort on.  That seems to work, however I cant override the default sort.  If its by date then I want descending and ifs by unitid I want ascending order.  Here is the formula that doesnt work when I try and add the sort direction.

If {?SortOrder} = "U" Then
 {TAG_InsuranceReport2;1.UnitId}
Else
  toText({TAG_InsuranceReport2;1.EndDate},"yyyy-MM-dd")

I have tried adding crAscendingOrder at the end of lines then the formula errors out and says its not part of the formula.

thanks
0
Comment
Question by:mgmhicks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 38790236
2 ideas

1st method
 Create 2 formulas
First formula
If {?SortOrder} = "U" Then
 {TAG_InsuranceReport2;1.UnitId}
Else
    "A"

Second formula
If {?SortOrder} <> "U" Then
 {TAG_InsuranceReport2;1.EndDate}
Else
   Date(1900,1,1)

Put the formulas in as the sort fields
Set the first to Ascending and the second to descending

2nd method
Use your existing formula a a group not a sort.  Groups are the first sorts done so the sorting will take place.
You can suppress the group header and footer.
When you add the group you can set the sort order.  Click the formula button to the right of use a formula to determine sort order
If {?SortOrder} = "U" Then
   crAscending
Else
   crDescending

mlmcc
0
 

Author Closing Comment

by:mgmhicks
ID: 38790481
Used method 2 worked great.  Thank you!!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question