Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Numbers to Strings 1

Status
Not open for further replies.

BoniR

MIS
Mar 29, 2005
138
US
hello!
I am using CR 9 and have a report that is based off a command. In this report I have created a Sort param that is linked to a Sort formula that looks at two fields and determines which one to sort by after the user has selected from the Sort param. My problem lies in that one field is a number and one is a string.
Currently I am using this as my Sort formula:
Code:
if {?Sort} = "N" then ({Command.PATIENT})
    else
        if {?Sort} = "I" then CStr (Truncate ({Command.PAT_NUM}), 0)
Unfortunately, some of the numbers are 5 digit and some are 4 digit. When I convert and truncate the number it looks at the digits in order from the left (ie 56,789 is less than 9,123). Is there a way to get around this?
Thanks in advance for any help you can give!
Boni


Boni J. Rychener
Hammerman Associates, Inc.
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
800-783-2269
 
Instead of the CStr(Truncate(...)) combination, try using ToText to insert leading zeros. Somthing like this:

ToText({command.PAT_NUM}, '00000')

If the PAT_NUM field could potentially contain more than just 5 digits, you'll want to increase the size of the format string ('00000') accordingly.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
YOU ARE AWESOME!!!
THANKS!
Boni
:)

Boni J. Rychener
Hammerman Associates, Inc.
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
800-783-2269
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top