how about something like:
local stringvar phone;
local numbervar x;
local stringvar one;
for x = 1 to len({table.field}) step 1(
one := mid({table.field}, x,1);
if isnumeric(one) then
phone := phone + one;
);
if len(phone) >= 10 then
"(" left(phone,3)+ ")" + mid(phone,4,3) + "-" + mid(phone,7, 4)
else
phone
ie, string out all the non numerics and format what is the first 10 digits (incase there are extensions)
if the dialing outside the north american dialing area, all bets are off, but for US/Canada this works.
HTH