Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Crystal Sort order

Posted on 2009-04-02
Medium Priority
559 Views
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
Question by:GregFromSeattle
[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

LVL 101

Assisted Solution

mlmcc earned 600 total points
ID: 24053704
I think you can only use 0

Try this

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

mlmcc
0

LVL 6

Accepted Solution

agandau earned 800 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 35

Assisted Solution

James0628 earned 600 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

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 35

Expert Comment

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

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
###### Suggested Courses
Course of the Month11 days, 1 hour left to enroll