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

Display only numbers within a string

Status
Not open for further replies.

mvalley

Technical User
Mar 4, 2011
80
US

I have a field, {case_record_audit_trail.cr_audit_addl_info}that displays the string- Old Patient Account#: 00035632421 (CT = S). I would like to display ONLY the number. Can a formula achieve this goal? If so, how would I write it?
 
You can loop through the field and only extract the numbers:

whileprintingrecords;
stringvar v_result := "";
numbervar x := 1;

while x <= len({OldAccountNumber})
do
(if isnumeric({OldAccountNumber}[x]) then v_result := v_result + {OldAccountNumber}[x];
x := x + 1);

v_result


However, if there are additional numbers after the actual account number this formula would include them. If that is a possibility post back and we can address it.
 
Thank you Brian, that worked PERFECTLY. Mary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top