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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need formula to convert part of text records to numbers for numerical sorting 1

Status
Not open for further replies.

jlr123

Technical User
Feb 24, 2014
117
US
My records are "item codes" - {'ESL_Svc_Codes_'.Item Code} which do not sort in the order I want them.
Example: "/ES103" is positioned after "/ES10".
/ES10
/ES103
/ES12
etc

I want to convert them or do whatever I need to so they will sort as follows:
/ES10
/ES12
/ES103

Please assist with formula. Thanks!
 
Yes, that seems correct.
I'm unsure why you'd get a database error like this.

Bob Suruncle
 
Bob, I created a cross tab report and the formula now works! Thanks again.
 
Bob, I am not familiar with some of the syntax and would like to know more about the formula. I understand local variables but not i p nm etc. I want to learn how to do this myself. Can you assist or tell me where to go to learn this? Thanks
 
Hi,
Variables are placeholders, and can make a formula more efficient and easier to read.
Variables can be named with whatever name you want. The only rules are that they must start with a letter, and may not be the same name as a built-in function.
Your variable name can't be "sum", or "len", or "length", as all of these are built in funtions
"i" is very common, usually used as a counter.
I used "nm" to stand for "Name"

There are 3 scopes to variables - Local, Global, and Shared

Local variables are available only in the formula that is being executed- their values cannot be used in other formulas.
Because of that, the same Local variable name can be used in multiple formulas without any problems.

Global variables are the default variable scope.
If you forget to define a scope, it will be Global by default.
Global variables that are set in one formula can be read and used by another formula.

Shared variables are used to pass values from a subreport back to the main report. (or vice versa)
the Shared scope forces the formula to be executed in the WhilePrintingRecords pass.

I would suggest that you read George Peck's book, "The Complete Reference" for whatever version of Crystal that you're using.

Bob Suruncle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top