Solved

sorting crystal reports within a formula

Posted on 2013-01-17
2
988 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 100

Accepted Solution

by:
mlmcc earned 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 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