After suggesting to the interface coders and the dba that they fall back to their real careers, and buying them their first bottle of MD20/20 to get then started, you'll probably need to use numerous checks for sanity, here I added a check for spaces:
I'd further wrap LB's
stringvar MyPhone:= replace(replace(replace({@phone}," ",""),"-",""),"/","");
// Then do some sanity checking:
if len(trim(MyPhone)) = 10 then
picture(MyPhone,"(xxx)-xxx-xxxx")
else
"*"&picture(MyPhone,"(xxx)-xxx-xxxx")
The second adding an asterisk to identify bad numbers.
There are plenty of other checks done to bad phone numbers, but the point is to correct the front end, adn issue a update/replace against the database to fix the problem permanently.
Great, if you still have difficulties, this will strip everything out except numeric values (probably the better solution overall):
whileprintingrecords;
numbervar Counter;
Stringvar MyPhone:="";
For Counter := 1 to len(trim({Customer.Phone})) do(
if isnumeric(mid({Customer.Phone},counter,1)) then
MyPhone:=MyPhone +mid({Customer.Phone},counter,1)
);
MyPhone
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.