Solved

Crystal Sort order

Posted on 2009-04-02
5
554 Views
Last Modified: 2012-05-06
Hi hope this is easy.  Would like to build a formula for Grouping/sorting purposes.  I would like to sort a currency field descending then a character field.  I was able to use the ToText Function to convert the Currency to a string then concatenate it to my text field. Problem is the currency doesn't seem to want to format.  Here is the Syntax: totext({TimeEntry.TEBillRate},0,'####')+{Employee.EmpTitle}.  It is displaying as $85 + the sting, I would like to have it come out with a couple leading blanks with no dollar sign like this "  85"+Text.  thanks  

0
Comment
Question by:GregFromSeattle
5 Comments
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 150 total points
ID: 24053704
I think you can only use 0
leading 0s

Try this

 totext(CDbl(({TimeEntry.TEBillRate},0,'####'))+{Employee.EmpTitle}

mlmcc
0
 
LVL 6

Accepted Solution

by:
agandau earned 200 total points
ID: 24054333
Perhaps you could cast your currency as a cDbl first.
Also, one way to pad the beginning of the expression is by using the Space() function.

This, for example, should get you close to where you want to be.

space(10 - len(totext(CDbl ({TimeEntry.TEBillRate}),0,'####'))) + totext(CDbl ({TimeEntry.TEBillRate}),0,'####')+{Employee.EmpTitle}  

It will calculate the length of your billrate cast as a string, so if it's 85, the length of "85" is two, and it will pad with 8 leading spaces.

Hope this helps.
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 150 total points
ID: 24056121
mlmcc's formula should work, but you need to remove/move a couple of parentheses.  The following should work:

 totext (CDbl ({TimeEntry.TEBillRate}),0,'####')+{Employee.EmpTitle}


 FWIW, the main thing in both mlmcc's and agandau's suggestions is to convert the field to a regular numeric data type (using CDbl) first.  Apparently your field is a currency data type and when converting one of those to a string, CR automatically adds a "$".  If you convert your field to a regular number first, CR won't do that.

 James
0
 

Author Closing Comment

by:GregFromSeattle
ID: 31565947
All comments helped but agandau helped the most with the leading blanks to get it to sort properly thank you all!
0
 
LVL 34

Expert Comment

by:James0628
ID: 24065642
You're welcome.  Glad I could help.

 For the record, the "####" format should also give you leading spaces.  If you want more spaces, just add more #'s.

 James
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal Reports remove alpha characters only 5 55
How to Bold a formula within another formula 4 36
display n/a in column 2 31
Count If in Crystal Reports 2 19
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
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 …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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