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!

In a string 1

Status
Not open for further replies.

NipperP

Technical User
Aug 9, 2002
41
GB
Hi

I have a varchar field which holds 3 codes

ON WCC4000

ON relates to the type of invoice
WCC relates to the batch number
4000 relates to the centre number

I am interested in getting the centre numbers out. The centre numbers and all the other numbers vary in length!!

Does anybody know of a formula which can take the last n amount of digits to the right. Not knowing how many digits there are!!

Hope this makes sense.

Thanks

Daniel
 
Wow - Has anyone seen my Crystal Ball?

You need to supply more information. At the very least some sample data with expected output.

Is there any consistancy at all to the data?


Mike
 
The following assumes that numbers are only found on the right end of the string:

numbervar i := 0;
numbervar j := len({table.string});
numbervar k := 0;
stringvar array result := "";

for i := 1 to j do(
if isnumeric({table.string}) then
(redim preserve result;
k := k + 1;
result[k] := mid({table.string},i)));
result[1];

-LB
 
lbass thanks that works a treat your a *.
Mbarron thanks for your input but no Crystal ball required!
 
If lbass is a * you should give him one. In fact I'll do it for you.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top