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!

extracting number from string

Status
Not open for further replies.

CDCOV

Technical User
Jan 3, 2003
4
GB
Hi

I have recently started using crystal 9

I am trying at the moment to extract a number reference from a mixed character number field There may be characters both before or after the number or not at all?

Secondly having got a list of numbers I need to order them incrementally so that 2 follows 1 etc.

can anyone tell me how to achieve this ( in simple terms)


Chris
 
Create a formula to place in the details section:

whileprintingrecords;
numbervar counter;
stringvar x := "";

for counter := 1 to len({table.string}) do(
if isnumeric({table.string}[counter]) then x := x + {table.string}[counter] else
x := x);
val(x)

Substitute your field for {table.string}. The result will be a number which will sort accurately.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top